@@ -21,15 +21,15 @@ import (
21
21
22
22
func kvGetCmd () * cobra.Command {
23
23
var (
24
- version int32
24
+ version uint32
25
25
)
26
26
27
27
cmd := & cobra.Command {
28
28
Use : "get PATH" ,
29
29
Short : "Retrieves the value from KMS's key-value store at the given key name" ,
30
30
Args : cobra .ExactArgs (1 ),
31
31
Run : func (cmd * cobra.Command , args []string ) {
32
- var v * int32
32
+ var v * uint32
33
33
if version != 0 {
34
34
v = & version
35
35
}
@@ -56,7 +56,7 @@ func kvGetCmd() *cobra.Command {
56
56
},
57
57
}
58
58
59
- cmd .Flags ().Int32Var (& version , "version" , 0 , "If passed, the value at the version number will be returned" )
59
+ cmd .Flags ().Uint32Var (& version , "version" , 0 , "If passed, the value at the version number will be returned" )
60
60
return cmd
61
61
}
62
62
@@ -78,14 +78,14 @@ func kvPutCmd() *cobra.Command {
78
78
os .Exit (1 )
79
79
}
80
80
81
- var c * int32
81
+ var c uint32
82
82
if cas != - 1 {
83
- c = & cas
83
+ c = utils . ToUint32 ( c )
84
84
}
85
85
body := types.PostSecretRequest {
86
86
Data : new (any ),
87
87
Options : & types.PostSecretOptions {
88
- Cas : c ,
88
+ Cas : & c ,
89
89
},
90
90
}
91
91
@@ -122,14 +122,14 @@ func kvPatchCmd() *cobra.Command {
122
122
os .Exit (1 )
123
123
}
124
124
125
- var c * int32
125
+ var c uint32
126
126
if cas != - 1 {
127
- c = & cas
127
+ c = utils . ToUint32 ( cas )
128
128
}
129
129
body := types.PostSecretRequest {
130
130
Data : new (any ),
131
131
Options : & types.PostSecretOptions {
132
- Cas : c ,
132
+ Cas : & c ,
133
133
},
134
134
}
135
135
@@ -150,7 +150,7 @@ func kvPatchCmd() *cobra.Command {
150
150
151
151
func kvDeleteCmd () * cobra.Command {
152
152
var (
153
- versions []int32
153
+ versions []uint
154
154
)
155
155
156
156
cmd := & cobra.Command {
@@ -161,70 +161,82 @@ func kvDeleteCmd() *cobra.Command {
161
161
if len (versions ) == 0 {
162
162
exit .OnErr (common .Client ().DeleteSecretRequest (cmd .Context (), args [0 ]))
163
163
} else {
164
- exit .OnErr (common .Client ().DeleteSecretVersions (cmd .Context (), args [0 ], versions ))
164
+ var v []uint32
165
+ for _ , val := range versions {
166
+ v = append (v , utils .ToUint32 (val ))
167
+ }
168
+ exit .OnErr (common .Client ().DeleteSecretVersions (cmd .Context (), args [0 ], v ))
165
169
}
166
170
},
167
171
}
168
172
169
- cmd .Flags ().Int32SliceVar (& versions , "versions" , []int32 {}, "Specifies the version numbers to delete. (Comma separated list of versions)" )
173
+ cmd .Flags ().UintSliceVar (& versions , "versions" , []uint {}, "Specifies the version numbers to delete. (Comma separated list of versions)" )
170
174
return cmd
171
175
}
172
176
173
177
func kvUndeleteCmd () * cobra.Command {
174
178
var (
175
- versions []int32
179
+ versions []uint
176
180
)
177
181
178
182
cmd := & cobra.Command {
179
183
Use : "undelete PATH" ,
180
184
Short : "Undeletes the data for the provided version and path in the key-value store." ,
181
185
Args : cobra .ExactArgs (1 ),
182
186
Run : func (cmd * cobra.Command , args []string ) {
183
- exit .OnErr (common .Client ().PostSecretUndelete (cmd .Context (), args [0 ], versions ))
187
+ var v []uint32
188
+ for _ , val := range versions {
189
+ v = append (v , utils .ToUint32 (val ))
190
+ }
191
+ exit .OnErr (common .Client ().PostSecretUndelete (cmd .Context (), args [0 ], v ))
184
192
},
185
193
}
186
194
187
- cmd .Flags ().Int32SliceVar (& versions , "versions" , []int32 {}, "Specifies the version numbers to delete. (Comma separated list of versions)" )
195
+ cmd .Flags ().UintSliceVar (& versions , "versions" , []uint {}, "Specifies the version numbers to delete. (Comma separated list of versions)" )
188
196
_ = cmd .MarkFlagRequired ("versions" )
189
197
return cmd
190
198
}
191
199
192
200
func kvDestroyCmd () * cobra.Command {
193
201
var (
194
- versions []int32
202
+ versions []uint
195
203
)
196
204
197
205
cmd := & cobra.Command {
198
206
Use : "destroy PATH" ,
199
207
Short : "Permanently removes the specified versions' data from the key-value store." ,
200
208
Args : cobra .ExactArgs (1 ),
201
209
Run : func (cmd * cobra.Command , args []string ) {
202
- exit .OnErr (common .Client ().PostSecretDestroy (cmd .Context (), args [0 ], versions ))
210
+ var v []uint32
211
+ for _ , val := range versions {
212
+ v = append (v , utils .ToUint32 (val ))
213
+ }
214
+ exit .OnErr (common .Client ().PostSecretDestroy (cmd .Context (), args [0 ], v ))
203
215
},
204
216
}
205
217
206
- cmd .Flags ().Int32SliceVar (& versions , "versions" , []int32 {}, "Specifies the version numbers to delete. (Comma separated list of versions)" )
218
+ cmd .Flags ().UintSliceVar (& versions , "versions" , []uint {}, "Specifies the version numbers to delete. (Comma separated list of versions)" )
207
219
_ = cmd .MarkFlagRequired ("versions" )
208
220
return cmd
209
221
}
210
222
211
223
func kvSubkeysCmd () * cobra.Command {
212
224
var (
213
- version int32
214
- depth int32
225
+ version uint32
226
+ depth uint32
215
227
)
216
228
217
229
cmd := & cobra.Command {
218
230
Use : "subkeys PATH" ,
219
231
Short : "Provides the subkeys within a secret entry that exists at the requested path." ,
220
232
Args : cobra .ExactArgs (1 ),
221
233
Run : func (cmd * cobra.Command , args []string ) {
222
- var v * int32
234
+ var v * uint32
223
235
if cmd .Flag ("version" ).Changed {
224
236
v = & version
225
237
}
226
238
227
- var d * int32
239
+ var d * uint32
228
240
if cmd .Flag ("depth" ).Changed {
229
241
d = & depth
230
242
}
@@ -251,8 +263,8 @@ func kvSubkeysCmd() *cobra.Command {
251
263
},
252
264
}
253
265
254
- cmd .Flags ().Int32Var (& version , "version" , 0 , "The version to return" )
255
- cmd .Flags ().Int32Var (& depth , "depth" , 0 , "Deepest nesting level to provide in the output" )
266
+ cmd .Flags ().Uint32Var (& version , "version" , 0 , "The version to return" )
267
+ cmd .Flags ().Uint32Var (& depth , "depth" , 0 , "Deepest nesting level to provide in the output" )
256
268
return cmd
257
269
}
258
270
0 commit comments