diff --git a/cmd/platform/instance-configuration/show.go b/cmd/platform/instance-configuration/show.go index dbd6c25a..90b60c74 100644 --- a/cmd/platform/instance-configuration/show.go +++ b/cmd/platform/instance-configuration/show.go @@ -19,8 +19,10 @@ package cmdinstanceconfig import ( "path/filepath" + "strconv" "github.com/elastic/cloud-sdk-go/pkg/api/platformapi/instanceconfigapi" + "github.com/elastic/cloud-sdk-go/pkg/util/ec" "github.com/spf13/cobra" cmdutil "github.com/elastic/ecctl/cmd/util" @@ -32,10 +34,27 @@ var showCmd = &cobra.Command{ Short: cmdutil.AdminReqDescription("Shows an instance configuration"), PreRunE: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { + configVersion, _ := cmd.Flags().GetString("config-version") + showDeleted, _ := cmd.Flags().GetBool("show-deleted") + + var version *int64 = nil + + if configVersion != "" { + parsedVersion, err := strconv.ParseInt(configVersion, 10, 64) + + version = ec.Int64(parsedVersion) + + if err != nil { + return err + } + } + res, err := instanceconfigapi.Get(instanceconfigapi.GetParams{ - API: ecctl.Get().API, - Region: ecctl.Get().Config.Region, - ID: args[0], + API: ecctl.Get().API, + Region: ecctl.Get().Config.Region, + ID: args[0], + ConfigVersion: version, + ShowDeleted: showDeleted, }) if err != nil { @@ -48,4 +67,6 @@ var showCmd = &cobra.Command{ func init() { Command.AddCommand(showCmd) + showCmd.Flags().StringP("config-version", "v", "", "Instance configuration version") + showCmd.Flags().Bool("show-deleted", false, "If set to true, allows to show deleted instance configurations") } diff --git a/docs/ecctl_platform_instance-configuration_show.adoc b/docs/ecctl_platform_instance-configuration_show.adoc index 4f4cb46b..5f8b61d8 100644 --- a/docs/ecctl_platform_instance-configuration_show.adoc +++ b/docs/ecctl_platform_instance-configuration_show.adoc @@ -11,7 +11,9 @@ ecctl platform instance-configuration show [flags] === Options ---- - -h, --help help for show + -v, --config-version string Instance configuration version + -h, --help help for show + --show-deleted If set to true, allows to show deleted instance configurations ---- [float] diff --git a/docs/ecctl_platform_instance-configuration_show.md b/docs/ecctl_platform_instance-configuration_show.md index 6c277d27..f5c040ae 100644 --- a/docs/ecctl_platform_instance-configuration_show.md +++ b/docs/ecctl_platform_instance-configuration_show.md @@ -9,7 +9,9 @@ ecctl platform instance-configuration show [flags] ### Options ``` - -h, --help help for show + -v, --config-version string Instance configuration version + -h, --help help for show + --show-deleted If set to true, allows to show deleted instance configurations ``` ### Options inherited from parent commands