@@ -19,8 +19,10 @@ package cmdinstanceconfig
19
19
20
20
import (
21
21
"path/filepath"
22
+ "strconv"
22
23
23
24
"github.com/elastic/cloud-sdk-go/pkg/api/platformapi/instanceconfigapi"
25
+ "github.com/elastic/cloud-sdk-go/pkg/util/ec"
24
26
"github.com/spf13/cobra"
25
27
26
28
cmdutil "github.com/elastic/ecctl/cmd/util"
@@ -32,10 +34,27 @@ var showCmd = &cobra.Command{
32
34
Short : cmdutil .AdminReqDescription ("Shows an instance configuration" ),
33
35
PreRunE : cobra .ExactArgs (1 ),
34
36
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
+
35
52
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 ,
39
58
})
40
59
41
60
if err != nil {
@@ -48,4 +67,6 @@ var showCmd = &cobra.Command{
48
67
49
68
func init () {
50
69
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" )
51
72
}
0 commit comments