From cb1b94c092313c3374129859dad38fbded6c40b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karen=20C=C3=A1rcamo?= Date: Fri, 8 May 2020 10:47:18 +1200 Subject: [PATCH] cmd: remove deployment shutdown --hide flag (#280) This patch removes the --hide flag from the ecctl deployment shutdown command. There was an issue where even if set to false, the API would return the following error if your user role was anything but "platform administrator": "Parameter [hide] is restricted and can only be set by a Platform administrator". As the shut down deployments are now hidden by default anyway, there is no need for the --hide flag any more. --- cmd/deployment/shutdown.go | 3 --- docs/ecctl_deployment_shutdown.adoc | 1 - docs/ecctl_deployment_shutdown.md | 1 - pkg/deployment/shutdown.go | 4 +--- 4 files changed, 1 insertion(+), 8 deletions(-) diff --git a/cmd/deployment/shutdown.go b/cmd/deployment/shutdown.go index 14ee23ed..99ff917c 100644 --- a/cmd/deployment/shutdown.go +++ b/cmd/deployment/shutdown.go @@ -40,13 +40,11 @@ var shutdownCmd = &cobra.Command{ } skipSnapshot, _ := cmd.Flags().GetBool("skip-snapshot") - hide, _ := cmd.Flags().GetBool("hide") res, err := deployment.Shutdown(deployment.ShutdownParams{ API: ecctl.Get().API, DeploymentID: args[0], SkipSnapshot: skipSnapshot, - Hide: hide, }) if err != nil { return err @@ -67,5 +65,4 @@ func init() { Command.AddCommand(shutdownCmd) shutdownCmd.Flags().BoolP("track", "t", false, cmdutil.TrackFlagMessage) shutdownCmd.Flags().Bool("skip-snapshot", false, "Skips taking an Elasticsearch snapshot prior to shutting down the deployment") - shutdownCmd.Flags().Bool("hide", false, "Hides the deployment and its resources after it has been shut down") } diff --git a/docs/ecctl_deployment_shutdown.adoc b/docs/ecctl_deployment_shutdown.adoc index 4a533af1..411c3ed0 100644 --- a/docs/ecctl_deployment_shutdown.adoc +++ b/docs/ecctl_deployment_shutdown.adoc @@ -17,7 +17,6 @@ ecctl deployment shutdown [flags] ---- -h, --help help for shutdown - --hide Hides the deployment and its resources after it has been shut down --skip-snapshot Skips taking an Elasticsearch snapshot prior to shutting down the deployment -t, --track Tracks the progress of the performed task ---- diff --git a/docs/ecctl_deployment_shutdown.md b/docs/ecctl_deployment_shutdown.md index e80563da..e892f050 100644 --- a/docs/ecctl_deployment_shutdown.md +++ b/docs/ecctl_deployment_shutdown.md @@ -14,7 +14,6 @@ ecctl deployment shutdown [flags] ``` -h, --help help for shutdown - --hide Hides the deployment and its resources after it has been shut down --skip-snapshot Skips taking an Elasticsearch snapshot prior to shutting down the deployment -t, --track Tracks the progress of the performed task ``` diff --git a/pkg/deployment/shutdown.go b/pkg/deployment/shutdown.go index 56628d1e..223828b7 100644 --- a/pkg/deployment/shutdown.go +++ b/pkg/deployment/shutdown.go @@ -33,7 +33,6 @@ type ShutdownParams struct { DeploymentID string SkipSnapshot bool - Hide bool } // Validate ensures the parameters are usable by Shutdown. @@ -61,8 +60,7 @@ func Shutdown(params ShutdownParams) (*models.DeploymentShutdownResponse, error) res, err := params.V1API.Deployments.ShutdownDeployment( deployments.NewShutdownDeploymentParams(). WithDeploymentID(params.DeploymentID). - WithSkipSnapshot(ec.Bool(params.SkipSnapshot)). - WithHide(ec.Bool(params.Hide)), + WithSkipSnapshot(ec.Bool(params.SkipSnapshot)), params.AuthWriter, ) if err != nil {