Skip to content

Commit 2a6f80f

Browse files
Add --config-version flag to instance configuration show command (#669)
* Add config-version to show cmd * Update docs
1 parent abe3883 commit 2a6f80f

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

cmd/platform/instance-configuration/show.go

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ package cmdinstanceconfig
1919

2020
import (
2121
"path/filepath"
22+
"strconv"
2223

2324
"github.com/elastic/cloud-sdk-go/pkg/api/platformapi/instanceconfigapi"
25+
"github.com/elastic/cloud-sdk-go/pkg/util/ec"
2426
"github.com/spf13/cobra"
2527

2628
cmdutil "github.com/elastic/ecctl/cmd/util"
@@ -32,10 +34,27 @@ var showCmd = &cobra.Command{
3234
Short: cmdutil.AdminReqDescription("Shows an instance configuration"),
3335
PreRunE: cobra.ExactArgs(1),
3436
RunE: func(cmd *cobra.Command, args []string) error {
37+
configVersion, _ := cmd.Flags().GetString("config-version")
38+
showDeleted, _ := cmd.Flags().GetBool("show-deleted")
39+
40+
var version *int64 = nil
41+
42+
if configVersion != "" {
43+
parsedVersion, err := strconv.ParseInt(configVersion, 10, 64)
44+
45+
version = ec.Int64(parsedVersion)
46+
47+
if err != nil {
48+
return err
49+
}
50+
}
51+
3552
res, err := instanceconfigapi.Get(instanceconfigapi.GetParams{
36-
API: ecctl.Get().API,
37-
Region: ecctl.Get().Config.Region,
38-
ID: args[0],
53+
API: ecctl.Get().API,
54+
Region: ecctl.Get().Config.Region,
55+
ID: args[0],
56+
ConfigVersion: version,
57+
ShowDeleted: showDeleted,
3958
})
4059

4160
if err != nil {
@@ -48,4 +67,6 @@ var showCmd = &cobra.Command{
4867

4968
func init() {
5069
Command.AddCommand(showCmd)
70+
showCmd.Flags().StringP("config-version", "v", "", "Instance configuration version")
71+
showCmd.Flags().Bool("show-deleted", false, "If set to true, allows to show deleted instance configurations")
5172
}

docs/ecctl_platform_instance-configuration_show.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ ecctl platform instance-configuration show <config id> [flags]
1111
=== Options
1212

1313
----
14-
-h, --help help for show
14+
-v, --config-version string Instance configuration version
15+
-h, --help help for show
16+
--show-deleted If set to true, allows to show deleted instance configurations
1517
----
1618

1719
[float]

docs/ecctl_platform_instance-configuration_show.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ ecctl platform instance-configuration show <config id> [flags]
99
### Options
1010

1111
```
12-
-h, --help help for show
12+
-v, --config-version string Instance configuration version
13+
-h, --help help for show
14+
--show-deleted If set to true, allows to show deleted instance configurations
1315
```
1416

1517
### Options inherited from parent commands

0 commit comments

Comments
 (0)