Skip to content

Commit 1986071

Browse files
gbahezreldesauw
authored andcommitted
fix: secret version parameter
1 parent 2b9ea85 commit 1986071

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cmd/okms/secretsV2/version.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func secretVersionPutCmd() *cobra.Command {
116116
return cmd
117117
}
118118

119-
func stateFunction(version uint32, state types.SecretV2State) func(cmd *cobra.Command, args []string) {
119+
func stateFunction(version *uint32, state types.SecretV2State) func(cmd *cobra.Command, args []string) {
120120
return func(cmd *cobra.Command, args []string) {
121121
if !cmd.Flag("version").Changed {
122122
fmt.Fprintln(os.Stderr, "Missing flag version")
@@ -126,7 +126,7 @@ func stateFunction(version uint32, state types.SecretV2State) func(cmd *cobra.Co
126126
State: state,
127127
}
128128

129-
resp := exit.OnErr2(common.Client().PutSecretVersionV2(cmd.Context(), args[0], version, body))
129+
resp := exit.OnErr2(common.Client().PutSecretVersionV2(cmd.Context(), args[0], *version, body))
130130
if cmd.Flag("output").Value.String() == string(flagsmgmt.JSON_OUTPUT_FORMAT) {
131131
output.JsonPrint(resp)
132132
} else {
@@ -143,7 +143,7 @@ func secretVersionActiveCmd() *cobra.Command {
143143
Use: "activate PATH --version VERSION ",
144144
Short: "Activate a secret version",
145145
Args: cobra.MinimumNArgs(1),
146-
Run: stateFunction(version, types.SecretV2StateActive),
146+
Run: stateFunction(&version, types.SecretV2StateActive),
147147
}
148148
cmd.Flags().Uint32Var(&version, "version", 0, "Secret version.")
149149
return cmd
@@ -157,7 +157,7 @@ func secretVersionDeactivateCmd() *cobra.Command {
157157
Use: "deactivate PATH --version VERSION ",
158158
Short: "Deactivate a secret version",
159159
Args: cobra.MinimumNArgs(1),
160-
Run: stateFunction(version, types.SecretV2StateDeactivated),
160+
Run: stateFunction(&version, types.SecretV2StateDeactivated),
161161
}
162162
cmd.Flags().Uint32Var(&version, "version", 0, "Secret version. If not set, the latest version will be returned.")
163163
return cmd
@@ -171,7 +171,7 @@ func secretVersionDeleteCmd() *cobra.Command {
171171
Use: "delete PATH --version VERSION ",
172172
Short: "Delete a secret version",
173173
Args: cobra.MinimumNArgs(1),
174-
Run: stateFunction(version, types.SecretV2StateDeleted),
174+
Run: stateFunction(&version, types.SecretV2StateDeleted),
175175
}
176176
cmd.Flags().Uint32Var(&version, "version", 0, "Secret version.")
177177
return cmd

0 commit comments

Comments
 (0)