Skip to content

Commit

Permalink
Move enroll command to xpack folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Pérez-Aradros Herce committed Aug 21, 2018
1 parent 259c156 commit e20a58a
Show file tree
Hide file tree
Showing 15 changed files with 72 additions and 17 deletions.
3 changes: 0 additions & 3 deletions libbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ type BeatsRootCmd struct {
ExportCmd *cobra.Command
TestCmd *cobra.Command
KeystoreCmd *cobra.Command
EnrollCmd *cobra.Command
}

// GenRootCmd returns the root command to use for your beat. It takes
Expand Down Expand Up @@ -87,7 +86,6 @@ func GenRootCmdWithIndexPrefixWithRunFlags(name, indexPrefix, version string, be
rootCmd.ExportCmd = genExportCmd(name, indexPrefix, version)
rootCmd.TestCmd = genTestCmd(name, version, beatCreator)
rootCmd.KeystoreCmd = genKeystoreCmd(name, indexPrefix, version, runFlags)
rootCmd.EnrollCmd = genEnrollCmd(name, version)

// Root command is an alias for run
rootCmd.Run = rootCmd.RunCmd.Run
Expand Down Expand Up @@ -119,7 +117,6 @@ func GenRootCmdWithIndexPrefixWithRunFlags(name, indexPrefix, version string, be
rootCmd.AddCommand(rootCmd.ExportCmd)
rootCmd.AddCommand(rootCmd.TestCmd)
rootCmd.AddCommand(rootCmd.KeystoreCmd)
rootCmd.AddCommand(rootCmd.EnrollCmd)

return rootCmd
}
7 changes: 5 additions & 2 deletions x-pack/auditbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

package cmd

import "github.com/elastic/beats/auditbeat/cmd"
import (
"github.com/elastic/beats/auditbeat/cmd"
xpackcmd "github.com/elastic/beats/x-pack/libbeat/cmd"
)

// RootCmd to handle beats cli
var RootCmd = cmd.RootCmd

func init() {
// TODO inject x-pack features
xpackcmd.AddXPack(RootCmd, cmd.Name)
}
7 changes: 5 additions & 2 deletions x-pack/filebeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

package cmd

import "github.com/elastic/beats/filebeat/cmd"
import (
"github.com/elastic/beats/filebeat/cmd"
xpackcmd "github.com/elastic/beats/x-pack/libbeat/cmd"
)

// RootCmd to handle beats cli
var RootCmd = cmd.RootCmd

func init() {
// TODO inject x-pack features
xpackcmd.AddXPack(RootCmd, cmd.Name)
}
7 changes: 5 additions & 2 deletions x-pack/heartbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

package cmd

import "github.com/elastic/beats/heartbeat/cmd"
import (
"github.com/elastic/beats/heartbeat/cmd"
xpackcmd "github.com/elastic/beats/x-pack/libbeat/cmd"
)

// RootCmd to handle beats cli
var RootCmd = cmd.RootCmd

func init() {
// TODO inject x-pack features
xpackcmd.AddXPack(RootCmd, cmd.Name)
}
6 changes: 5 additions & 1 deletion libbeat/cmd/enroll.go → x-pack/libbeat/cmd/enroll.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package cmd

import (
Expand All @@ -8,7 +12,7 @@ import (

"github.com/elastic/beats/libbeat/cmd/instance"
"github.com/elastic/beats/libbeat/common/cli"
"github.com/elastic/beats/libbeat/management"
"github.com/elastic/beats/x-pack/libbeat/management"
)

func getBeat(name, version string) (*instance.Beat, error) {
Expand Down
12 changes: 12 additions & 0 deletions x-pack/libbeat/cmd/inject.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package cmd

import "github.com/elastic/beats/libbeat/cmd"

// AddXPack extends the given root folder with XPack features
func AddXPack(root *cmd.BeatsRootCmd, name string) {
root.AddCommand(genEnrollCmd(name, ""))
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package api

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package api

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package api

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package api

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package management

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.

package management

import (
"github.com/elastic/beats/libbeat/cmd/instance"
"github.com/elastic/beats/libbeat/management/api"
"github.com/elastic/beats/x-pack/libbeat/management/api"
)

// Enroll this beat to the given kibana
Expand Down
7 changes: 5 additions & 2 deletions x-pack/metricbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

package cmd

import "github.com/elastic/beats/metricbeat/cmd"
import (
"github.com/elastic/beats/metricbeat/cmd"
xpackcmd "github.com/elastic/beats/x-pack/libbeat/cmd"
)

// RootCmd to handle beats cli
var RootCmd = cmd.RootCmd

func init() {
// TODO inject x-pack features
xpackcmd.AddXPack(RootCmd, cmd.Name)
}
7 changes: 5 additions & 2 deletions x-pack/packetbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

package cmd

import "github.com/elastic/beats/packetbeat/cmd"
import (
"github.com/elastic/beats/packetbeat/cmd"
xpackcmd "github.com/elastic/beats/x-pack/libbeat/cmd"
)

// RootCmd to handle beats cli
var RootCmd = cmd.RootCmd

func init() {
// TODO inject x-pack features
xpackcmd.AddXPack(RootCmd, cmd.Name)
}
7 changes: 5 additions & 2 deletions x-pack/winlogbeat/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

package cmd

import "github.com/elastic/beats/winlogbeat/cmd"
import (
"github.com/elastic/beats/winlogbeat/cmd"
xpackcmd "github.com/elastic/beats/x-pack/libbeat/cmd"
)

// RootCmd to handle beats cli
var RootCmd = cmd.RootCmd

func init() {
// TODO inject x-pack features
xpackcmd.AddXPack(RootCmd, cmd.Name)
}

0 comments on commit e20a58a

Please sign in to comment.