Skip to content

Commit 78561f6

Browse files
authored
misc: Replace all references from cluster type to resource kind (#208)
Replaces all references from cluster type to resource kind. This change includes replacing all --type flags to --kind for the ecctl deployment resource commands and ecctl deployment plan cancel.
1 parent 5c8f2d9 commit 78561f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+305
-305
lines changed

cmd/deployment/appsearch/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var deleteCmd = &cobra.Command{
4545
ResourceParams: deployment.ResourceParams{
4646
API: ecctl.Get().API,
4747
DeploymentID: args[0],
48-
Type: "appsearch",
48+
Kind: "appsearch",
4949
RefID: refID,
5050
},
5151
})

cmd/deployment/appsearch/show.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var showAppSearchCmd = &cobra.Command{
4242
showPlans = true
4343
}
4444
res, err := deployment.GetResource(deployment.GetResourceParams{
45-
Type: "appsearch",
45+
Kind: "appsearch",
4646
GetParams: deployment.GetParams{
4747
API: ecctl.Get().API,
4848
DeploymentID: args[0],

cmd/deployment/appsearch/shutdown.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var shutdownCmd = &cobra.Command{
4747
ResourceParams: deployment.ResourceParams{
4848
API: ecctl.Get().API,
4949
DeploymentID: args[0],
50-
Type: "appsearch",
50+
Kind: "appsearch",
5151
RefID: refID,
5252
},
5353
SkipSnapshot: skipSnapshot,

cmd/deployment/appsearch/upgrade.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ var upgradeCmd = &cobra.Command{
3535
Short: "Upgrades an AppSearch deployment to the Elasticsearch deployment version",
3636
PreRunE: sdkcmdutil.MinimumNArgsAndUUID(1),
3737
RunE: func(cmd *cobra.Command, args []string) error {
38-
resType := "appsearch"
38+
resKind := "appsearch"
3939
refID, _ := cmd.Flags().GetString("ref-id")
4040

4141
res, err := depresource.UpgradeStateless(deployment.ResourceParams{
4242
API: ecctl.Get().API,
4343
DeploymentID: args[0],
44-
Type: resType,
44+
Kind: resKind,
4545
RefID: refID,
4646
})
4747

@@ -58,7 +58,7 @@ var upgradeCmd = &cobra.Command{
5858
OutputDevice: ecctl.Get().Config.OutputDevice,
5959
Resources: []*models.DeploymentResource{{
6060
ID: ec.String(res.ResourceID),
61-
Kind: ec.String(resType),
61+
Kind: ec.String(resKind),
6262
RefID: ec.String(refID),
6363
}},
6464
})

cmd/deployment/plan/cancel.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ import (
2929

3030
// cancelPlan is the deployment subcommand
3131
var cancelPlan = &cobra.Command{
32-
Use: "cancel <deployment id> --type <type> [--ref-id <ref-id>]",
32+
Use: "cancel <deployment id> --kind <kind> [--ref-id <ref-id>]",
3333
Short: "Cancels a resource's pending plan",
3434
PreRunE: sdkcmdutil.MinimumNArgsAndUUID(1),
3535
RunE: func(cmd *cobra.Command, args []string) error {
3636
force, _ := cmd.Flags().GetBool("force")
37-
resType, _ := cmd.Flags().GetString("type")
37+
resKind, _ := cmd.Flags().GetString("kind")
3838
refID, _ := cmd.Flags().GetString("ref-id")
3939

4040
_, err := depresource.CancelPlan(depresource.CancelPlanParams{
4141
ResourceParams: deployment.ResourceParams{
4242
API: ecctl.Get().API,
4343
DeploymentID: args[0],
44-
Type: resType,
44+
Kind: resKind,
4545
RefID: refID,
4646
},
4747
ForceDelete: force,
@@ -53,7 +53,7 @@ var cancelPlan = &cobra.Command{
5353

5454
func init() {
5555
Command.AddCommand(cancelPlan)
56-
cmdutil.AddTypeFlag(cancelPlan, "Required", true)
57-
cancelPlan.MarkFlagRequired("type")
56+
cmdutil.AddKindFlag(cancelPlan, "Required", true)
57+
cancelPlan.MarkFlagRequired("kind")
5858
cancelPlan.Flags().String("ref-id", "", "Optional deployment RefId, if not set, the RefId will be auto-discovered")
5959
}

cmd/deployment/resource/delete.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ import (
3131

3232
// deleteCmd is the deployment subcommand
3333
var deleteCmd = &cobra.Command{
34-
Use: "delete <deployment id> --type <type> --ref-id <ref-id>",
34+
Use: "delete <deployment id> --kind <kind> --ref-id <ref-id>",
3535
Short: "Deletes a previously shut down deployment resource",
3636
PreRunE: sdkcmdutil.MinimumNArgsAndUUID(1),
3737
RunE: func(cmd *cobra.Command, args []string) error {
38-
resType, _ := cmd.Flags().GetString("type")
38+
resKind, _ := cmd.Flags().GetString("kind")
3939
refID, _ := cmd.Flags().GetString("ref-id")
4040

4141
force, _ := cmd.Flags().GetBool("force")
42-
var msg = "This action will delete a deployment's resource type and its configuration history. Do you want to continue? [y/n]: "
42+
var msg = "This action will delete a deployment's resource kind and its configuration history. Do you want to continue? [y/n]: "
4343
if !force && !sdkcmdutil.ConfirmAction(msg, os.Stderr, os.Stdout) {
4444
return nil
4545
}
@@ -48,7 +48,7 @@ var deleteCmd = &cobra.Command{
4848
ResourceParams: deployment.ResourceParams{
4949
API: ecctl.Get().API,
5050
DeploymentID: args[0],
51-
Type: resType,
51+
Kind: resKind,
5252
RefID: refID,
5353
},
5454
})
@@ -57,7 +57,7 @@ var deleteCmd = &cobra.Command{
5757

5858
func init() {
5959
Command.AddCommand(deleteCmd)
60-
cmdutil.AddTypeFlag(deleteCmd, "Required stateless", false)
61-
deleteCmd.MarkFlagRequired("type")
60+
cmdutil.AddKindFlag(deleteCmd, "Required stateless", false)
61+
deleteCmd.MarkFlagRequired("kind")
6262
deleteCmd.Flags().String("ref-id", "", "Optional deployment RefId, auto-discovered if not specified")
6363
}

cmd/deployment/resource/restore.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,33 @@ import (
3232

3333
// restoreCmd is the deployment subcommand
3434
var restoreCmd = &cobra.Command{
35-
Use: "restore <deployment id> --type <type> --ref-id <ref-id>",
35+
Use: "restore <deployment id> --kind <kind> --ref-id <ref-id>",
3636
Short: "Restores a previously shut down deployment resource",
3737
PreRunE: sdkcmdutil.MinimumNArgsAndUUID(1),
3838
RunE: func(cmd *cobra.Command, args []string) error {
39-
resType, _ := cmd.Flags().GetString("type")
39+
resKind, _ := cmd.Flags().GetString("kind")
4040
refID, _ := cmd.Flags().GetString("ref-id")
4141
restoreSnapshot, _ := cmd.Flags().GetBool("restore-snapshot")
4242

4343
force, _ := cmd.Flags().GetBool("force")
44-
var esType = resType == "elasticsearch"
45-
var dataLoss = esType && !restoreSnapshot
44+
var esKind = resKind == "elasticsearch"
45+
var dataLoss = esKind && !restoreSnapshot
4646
var msg = "This action restores an Elasticsearch resource without its snapshot which might incur data loss, do you want to continue? [y/n]: "
4747
if dataLoss && !force && !sdkcmdutil.ConfirmAction(msg, os.Stderr, os.Stdout) {
4848
return nil
4949
}
5050

51-
if restoreSnapshot && !esType {
51+
if restoreSnapshot && !esKind {
5252
fmt.Fprintf(ecctl.Get().Config.ErrorDevice,
53-
"Using --restore-snapshot on resource type \"%s\" will have no effect\n", resType,
53+
"Using --restore-snapshot on resource kind \"%s\" will have no effect\n", resKind,
5454
)
5555
}
5656

5757
return depresource.Restore(depresource.RestoreParams{
5858
ResourceParams: deployment.ResourceParams{
5959
API: ecctl.Get().API,
6060
DeploymentID: args[0],
61-
Type: resType,
61+
Kind: resKind,
6262
RefID: refID,
6363
},
6464
RestoreSnapshot: restoreSnapshot,
@@ -68,8 +68,8 @@ var restoreCmd = &cobra.Command{
6868

6969
func init() {
7070
Command.AddCommand(restoreCmd)
71-
cmdutil.AddTypeFlag(restoreCmd, "Required", true)
72-
restoreCmd.MarkFlagRequired("type")
71+
cmdutil.AddKindFlag(restoreCmd, "Required", true)
72+
restoreCmd.MarkFlagRequired("kind")
7373
restoreCmd.Flags().String("ref-id", "", "Optional deployment RefId, auto-discovered if not specified")
7474
restoreCmd.Flags().Bool("restore-snapshot", false, "Optional flag to toggle restoring a snapshot for an Elasticsearch resource. It has no effect for other resources")
7575
}

cmd/deployment/resource/shutdown.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,18 @@ import (
3131

3232
// shutdownCmd is the deployment subcommand
3333
var shutdownCmd = &cobra.Command{
34-
Use: "shutdown <deployment id> --type <type> --ref-id <ref-id>",
35-
Short: "Shuts down a deployment resource by its type and ref-id",
34+
Use: "shutdown <deployment id> --kind <kind> --ref-id <ref-id>",
35+
Short: "Shuts down a deployment resource by its kind and ref-id",
3636
Long: shutdownLong,
3737
PreRunE: sdkcmdutil.MinimumNArgsAndUUID(1),
3838
RunE: func(cmd *cobra.Command, args []string) error {
39-
resType, _ := cmd.Flags().GetString("type")
39+
resKind, _ := cmd.Flags().GetString("kind")
4040
refID, _ := cmd.Flags().GetString("ref-id")
4141
skipSnapshot, _ := cmd.Flags().GetBool("skip-snapshot")
4242
hide, _ := cmd.Flags().GetBool("hide")
4343

4444
force, _ := cmd.Flags().GetBool("force")
45-
var msg = "This action will shut down a deployment's resource type. Do you want to continue? [y/n]: "
45+
var msg = "This action will shut down a deployment's resource kind. Do you want to continue? [y/n]: "
4646
if !force && !sdkcmdutil.ConfirmAction(msg, os.Stderr, os.Stdout) {
4747
return nil
4848
}
@@ -51,7 +51,7 @@ var shutdownCmd = &cobra.Command{
5151
ResourceParams: deployment.ResourceParams{
5252
API: ecctl.Get().API,
5353
DeploymentID: args[0],
54-
Type: resType,
54+
Kind: resKind,
5555
RefID: refID,
5656
},
5757
SkipSnapshot: skipSnapshot,
@@ -63,8 +63,8 @@ var shutdownCmd = &cobra.Command{
6363

6464
func init() {
6565
Command.AddCommand(shutdownCmd)
66-
cmdutil.AddTypeFlag(shutdownCmd, "Required", true)
67-
shutdownCmd.MarkFlagRequired("type")
66+
cmdutil.AddKindFlag(shutdownCmd, "Required", true)
67+
shutdownCmd.MarkFlagRequired("kind")
6868
shutdownCmd.Flags().String("ref-id", "", "Optional deployment RefId, auto-discovered if not specified")
6969
shutdownCmd.Flags().Bool("skip-snapshot", false, "Optional flag to toggle skipping the resource snapshot before shutting it down")
7070
shutdownCmd.Flags().Bool("hide", false, "Optionally hides the deployment resource from being listed by default")

cmd/deployment/resource/shutdown_help.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
package cmddeploymentresource
1919

2020
const (
21-
shutdownLong = `Shuts down a deployment resource type (APM, Appsearch, Elasticsearch, Kibana). Shutting down a
22-
type doesn't necessarily shut down the deployment itself but rather a specific resource.`
21+
shutdownLong = `Shuts down a deployment resource kind (APM, Appsearch, Elasticsearch, Kibana). Shutting down a
22+
kind doesn't necessarily shut down the deployment itself but rather a specific resource.`
2323
)

cmd/deployment/resource/start-maintenance.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ import (
3232
)
3333

3434
var startMaintCmd = &cobra.Command{
35-
Use: "start-maintenance <deployment id> --type <type> [--all|--i <instance-id>,<instance-id>]",
35+
Use: "start-maintenance <deployment id> --kind <kind> [--all|--i <instance-id>,<instance-id>]",
3636
Short: "Starts maintenance mode on a deployment resource",
3737
PreRunE: sdkcmdutil.MinimumNArgsAndUUID(1),
3838
RunE: func(cmd *cobra.Command, args []string) error {
39-
resType, _ := cmd.Flags().GetString("type")
39+
resKind, _ := cmd.Flags().GetString("kind")
4040
refID, _ := cmd.Flags().GetString("ref-id")
4141
instanceID, _ := cmd.Flags().GetStringSlice("instance-id")
4242
ignoreMissing, _ := cmd.Flags().GetBool("ignore-missing")
@@ -57,7 +57,7 @@ var startMaintCmd = &cobra.Command{
5757
ResourceParams: deployment.ResourceParams{
5858
API: ecctl.Get().API,
5959
DeploymentID: args[0],
60-
Type: resType,
60+
Kind: resKind,
6161
RefID: refID,
6262
},
6363
All: all,
@@ -76,10 +76,10 @@ var startMaintCmd = &cobra.Command{
7676

7777
func init() {
7878
Command.AddCommand(startMaintCmd)
79-
startMaintCmd.Flags().Bool("all", false, "Starts maintenance mode on all instances of a defined resource type")
79+
startMaintCmd.Flags().Bool("all", false, "Starts maintenance mode on all instances of a defined resource kind")
8080
startMaintCmd.Flags().Bool("ignore-missing", false, "If set and the specified instance does not exist, then quietly proceed to the next instance")
81-
cmdutil.AddTypeFlag(startMaintCmd, "Required", true)
82-
startMaintCmd.MarkFlagRequired("type")
81+
cmdutil.AddKindFlag(startMaintCmd, "Required", true)
82+
startMaintCmd.MarkFlagRequired("kind")
8383
startMaintCmd.Flags().String("ref-id", "", "Optional deployment RefId, if not set, the RefId will be auto-discovered")
8484
startMaintCmd.Flags().StringSliceP("instance-id", "i", nil, "Deployment instance IDs to use (e.g. instance-0000000001)")
8585
}

0 commit comments

Comments
 (0)