Skip to content

Commit 2614575

Browse files
author
Jan Sternagel
committed
Upgrade KMS to v1.0.0
1 parent 2f9e6d3 commit 2614575

File tree

9 files changed

+3
-31
lines changed

9 files changed

+3
-31
lines changed

docs/stackit_beta_kms_key_create.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ stackit beta kms key create [flags]
2424

2525
```
2626
--algorithm string En-/Decryption / signing algorithm
27-
--backend string The backend that is responsible for maintaining this key (default "software")
2827
--description string Optinal description of the Key
2928
-h, --help Help for "stackit beta kms key create"
3029
--import-only States whether versions can be created or only imported

docs/stackit_beta_kms_wrappingkey_create.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ stackit beta kms wrappingkey create [flags]
2424

2525
```
2626
--algorithm string En-/Decryption algorithm
27-
--backend string The backend that is responsible for maintaining this wrapping key (default "software")
2827
--description string Optinal description of the Wrapping Key
2928
-h, --help Help for "stackit beta kms wrappingkey create"
3029
--key-ring string ID of the KMS Key Ring

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ require (
238238
github.com/sourcegraph/conc v0.3.0 // indirect
239239
github.com/spf13/afero v1.14.0 // indirect
240240
github.com/spf13/cast v1.7.1 // indirect
241-
github.com/stackitcloud/stackit-sdk-go/services/kms v0.5.1
241+
github.com/stackitcloud/stackit-sdk-go/services/kms v1.0.0
242242
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.5.1
243243
github.com/stackitcloud/stackit-sdk-go/services/logme v0.25.1
244244
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.25.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,10 +573,10 @@ github.com/stackitcloud/stackit-sdk-go/services/dns v0.17.1 h1:CnhAMLql0MNmAeq4r
573573
github.com/stackitcloud/stackit-sdk-go/services/dns v0.17.1/go.mod h1:7Bx85knfNSBxulPdJUFuBePXNee3cO+sOTYnUG6M+iQ=
574574
github.com/stackitcloud/stackit-sdk-go/services/git v0.7.1 h1:hkFixFnBcQzU4BSIZFITc8N0gK0pUYk7mk0wdUu5Ki8=
575575
github.com/stackitcloud/stackit-sdk-go/services/git v0.7.1/go.mod h1:Ng1EzrRndG3iGXGH90AZJz//wfK+2YOyDwTnTLwX3a4=
576-
github.com/stackitcloud/stackit-sdk-go/services/kms v0.5.1 h1:QWG78oHtX5tjTQSnLpsBSgrYPEf2nDnb8nhE+K3NztA=
577-
github.com/stackitcloud/stackit-sdk-go/services/kms v0.5.1/go.mod h1:KEPVoO21pC4bjy5l0nyhjUJ0+uVwVWb+k2TYrzJ8xYw=
578576
github.com/stackitcloud/stackit-sdk-go/services/iaas v0.29.2 h1:BvrbqLi9u0943TTkflPDLGbXgqgVzv7oy8tZHD3q3lg=
579577
github.com/stackitcloud/stackit-sdk-go/services/iaas v0.29.2/go.mod h1:b/jgJf7QHdRzU2fmZeJJtu5j0TAevDRghzcn5MyRmOI=
578+
github.com/stackitcloud/stackit-sdk-go/services/kms v1.0.0 h1:zxoOv7Fu+FmdsvTKiKkbmLItrMKfL+QoVtz9ReEF30E=
579+
github.com/stackitcloud/stackit-sdk-go/services/kms v1.0.0/go.mod h1:KEPVoO21pC4bjy5l0nyhjUJ0+uVwVWb+k2TYrzJ8xYw=
580580
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.5.1 h1:OdJEs8eOfrzn9tCBDLxIyP8hX50zPfcXNYnRoQX+chs=
581581
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.5.1/go.mod h1:11uzaOPCF9SeDHXEGOPMlHDD3J5r2TnvCGUwW9Igq9c=
582582
github.com/stackitcloud/stackit-sdk-go/services/logme v0.25.1 h1:hv5WrRU9rN6Jx4OwdOGJRyaQrfA9p1tzEoQK6/CDyoA=

internal/cmd/beta/kms/key/create/create.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const (
2525
keyRingIdFlag = "key-ring"
2626

2727
algorithmFlag = "algorithm"
28-
backendFlag = "backend"
2928
descriptionFlag = "description"
3029
displayNameFlag = "name"
3130
importOnlyFlag = "import-only"
@@ -37,7 +36,6 @@ type inputModel struct {
3736
KeyRingId string
3837

3938
Algorithm *string
40-
Backend string // Keep "backend" as a variable, but set the default to "software" (see UI)
4139
Description *string
4240
Name *string
4341
ImportOnly bool // Default false
@@ -116,7 +114,6 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
116114
GlobalFlagModel: globalFlags,
117115
KeyRingId: flags.FlagToStringValue(p, cmd, keyRingIdFlag),
118116
Algorithm: flags.FlagToStringPointer(p, cmd, algorithmFlag),
119-
Backend: flags.FlagWithDefaultToStringValue(p, cmd, backendFlag),
120117
Name: flags.FlagToStringPointer(p, cmd, displayNameFlag),
121118
Description: flags.FlagToStringPointer(p, cmd, descriptionFlag),
122119
ImportOnly: flags.FlagToBoolValue(p, cmd, importOnlyFlag),
@@ -147,7 +144,6 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient kmsKeyClient
147144
DisplayName: model.Name,
148145
Description: model.Description,
149146
Algorithm: kms.CreateKeyPayloadGetAlgorithmAttributeType(model.Algorithm),
150-
Backend: kms.CreateKeyPayloadGetBackendAttributeType(&model.Backend),
151147
Purpose: kms.CreateKeyPayloadGetPurposeAttributeType(model.Purpose),
152148
ImportOnly: &model.ImportOnly,
153149
})
@@ -185,7 +181,6 @@ func outputResult(p *print.Printer, outputFormat, projectLabel string, resp *kms
185181
func configureFlags(cmd *cobra.Command) {
186182
cmd.Flags().Var(flags.UUIDFlag(), keyRingIdFlag, "ID of the KMS Key Ring")
187183
cmd.Flags().String(algorithmFlag, "", "En-/Decryption / signing algorithm")
188-
cmd.Flags().String(backendFlag, "software", "The backend that is responsible for maintaining this key")
189184
cmd.Flags().String(displayNameFlag, "", "The display name to distinguish multiple keys")
190185
cmd.Flags().String(descriptionFlag, "", "Optinal description of the Key")
191186
cmd.Flags().Bool(importOnlyFlag, false, "States whether versions can be created or only imported")

internal/cmd/beta/kms/key/create/create_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const (
2222
testPurpose = "asymmetric_encrypt_decrypt"
2323
testDescription = "my key description"
2424
testImportOnly = "true"
25-
testBackend = "notSoftware"
2625
)
2726

2827
type testCtxKey struct{}
@@ -45,7 +44,6 @@ func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]st
4544
purposeFlag: testPurpose,
4645
descriptionFlag: testDescription,
4746
importOnlyFlag: testImportOnly,
48-
backendFlag: testBackend,
4947
}
5048
for _, mod := range mods {
5149
mod(flagValues)
@@ -67,7 +65,6 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
6765
Purpose: utils.Ptr(testPurpose),
6866
Description: utils.Ptr(testDescription),
6967
ImportOnly: true, // Watch out: ImportOnly is not testImportOnly!
70-
Backend: testBackend,
7168
}
7269
for _, mod := range mods {
7370
mod(model)
@@ -84,7 +81,6 @@ func fixtureRequest(mods ...func(request *kms.ApiCreateKeyRequest)) kms.ApiCreat
8481
Purpose: kms.CreateKeyPayloadGetPurposeAttributeType(utils.Ptr(testPurpose)),
8582
Description: utils.Ptr(testDescription),
8683
ImportOnly: utils.Ptr(true),
87-
Backend: kms.CreateKeyPayloadGetBackendAttributeType(utils.Ptr(testBackend)),
8884
})
8985

9086
for _, mod := range mods {
@@ -111,13 +107,11 @@ func TestParseInput(t *testing.T) {
111107
flagValues: fixtureFlagValues(func(flagValues map[string]string) {
112108
delete(flagValues, descriptionFlag)
113109
delete(flagValues, importOnlyFlag)
114-
delete(flagValues, backendFlag)
115110
}),
116111
isValid: true,
117112
expectedModel: fixtureInputModel(func(model *inputModel) {
118113
model.Description = nil
119114
model.ImportOnly = false
120-
model.Backend = "software"
121115
}),
122116
},
123117
{
@@ -254,7 +248,6 @@ func TestBuildRequest(t *testing.T) {
254248
Purpose: kms.CreateKeyPayloadGetPurposeAttributeType(utils.Ptr(testPurpose)),
255249
Description: nil,
256250
ImportOnly: utils.Ptr(false),
257-
Backend: kms.CreateKeyPayloadGetBackendAttributeType(utils.Ptr(testBackend)),
258251
}),
259252
},
260253
}

internal/cmd/beta/kms/wrappingkey/create/create.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const (
2727
keyRingIdFlag = "key-ring"
2828

2929
algorithmFlag = "algorithm"
30-
backendFlag = "backend"
3130
descriptionFlag = "description"
3231
displayNameFlag = "name"
3332
purposeFlag = "purpose"
@@ -38,7 +37,6 @@ type inputModel struct {
3837
KeyRingId string
3938

4039
Algorithm *string
41-
Backend string // Keep "backend" as a variable, but set the default to "software" (see UI)
4240
Description *string
4341
Name *string
4442
Purpose *string
@@ -125,7 +123,6 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
125123
GlobalFlagModel: globalFlags,
126124
KeyRingId: flags.FlagToStringValue(p, cmd, keyRingIdFlag),
127125
Algorithm: flags.FlagToStringPointer(p, cmd, algorithmFlag),
128-
Backend: flags.FlagWithDefaultToStringValue(p, cmd, backendFlag),
129126
Name: flags.FlagToStringPointer(p, cmd, displayNameFlag),
130127
Description: flags.FlagToStringPointer(p, cmd, descriptionFlag),
131128
Purpose: flags.FlagToStringPointer(p, cmd, purposeFlag),
@@ -157,7 +154,6 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient kmsWrappingK
157154
Description: model.Description,
158155
Algorithm: kms.CreateWrappingKeyPayloadGetAlgorithmAttributeType(model.Algorithm),
159156
Purpose: kms.CreateWrappingKeyPayloadGetPurposeAttributeType(model.Purpose),
160-
Backend: kms.CreateWrappingKeyPayloadGetBackendAttributeType(&model.Backend),
161157
})
162158
return req, nil
163159
}
@@ -193,7 +189,6 @@ func outputResult(p *print.Printer, outputFormat, projectLabel string, resp *kms
193189
func configureFlags(cmd *cobra.Command) {
194190
cmd.Flags().Var(flags.UUIDFlag(), keyRingIdFlag, "ID of the KMS Key Ring")
195191
cmd.Flags().String(algorithmFlag, "", "En-/Decryption algorithm")
196-
cmd.Flags().String(backendFlag, "software", "The backend that is responsible for maintaining this wrapping key")
197192
cmd.Flags().String(displayNameFlag, "", "The display name to distinguish multiple wrapping keys")
198193
cmd.Flags().String(descriptionFlag, "", "Optinal description of the Wrapping Key")
199194
cmd.Flags().String(purposeFlag, "", "Purpose of the Wrapping Key. Enum: 'wrap_symmetric_key', 'wrap_asymmetric_key' ")

internal/cmd/beta/kms/wrappingkey/create/create_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const (
2121
testDisplayName = "my-key"
2222
testPurpose = "asymmetric_encrypt_decrypt"
2323
testDescription = "my key description"
24-
testBackend = "notSoftware"
2524
)
2625

2726
type testCtxKey struct{}
@@ -43,7 +42,6 @@ func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]st
4342
displayNameFlag: testDisplayName,
4443
purposeFlag: testPurpose,
4544
descriptionFlag: testDescription,
46-
backendFlag: testBackend,
4745
}
4846
for _, mod := range mods {
4947
mod(flagValues)
@@ -64,7 +62,6 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
6462
Name: utils.Ptr(testDisplayName),
6563
Purpose: utils.Ptr(testPurpose),
6664
Description: utils.Ptr(testDescription),
67-
Backend: testBackend,
6865
}
6966
for _, mod := range mods {
7067
mod(model)
@@ -80,7 +77,6 @@ func fixtureRequest(mods ...func(request *kms.ApiCreateWrappingKeyRequest)) kms.
8077
DisplayName: utils.Ptr(testDisplayName),
8178
Purpose: kms.CreateWrappingKeyPayloadGetPurposeAttributeType(utils.Ptr(testPurpose)),
8279
Description: utils.Ptr(testDescription),
83-
Backend: kms.CreateWrappingKeyPayloadGetBackendAttributeType(utils.Ptr(testBackend)),
8480
})
8581

8682
for _, mod := range mods {
@@ -106,12 +102,10 @@ func TestParseInput(t *testing.T) {
106102
description: "optional flags omitted",
107103
flagValues: fixtureFlagValues(func(flagValues map[string]string) {
108104
delete(flagValues, descriptionFlag)
109-
delete(flagValues, backendFlag)
110105
}),
111106
isValid: true,
112107
expectedModel: fixtureInputModel(func(model *inputModel) {
113108
model.Description = nil
114-
model.Backend = "software"
115109
}),
116110
},
117111
{
@@ -245,7 +239,6 @@ func TestBuildRequest(t *testing.T) {
245239
Algorithm: kms.CreateWrappingKeyPayloadGetAlgorithmAttributeType(utils.Ptr(testAlgorithm)),
246240
DisplayName: utils.Ptr(testDisplayName),
247241
Purpose: kms.CreateWrappingKeyPayloadGetPurposeAttributeType(utils.Ptr(testPurpose)),
248-
Backend: kms.CreateWrappingKeyPayloadGetBackendAttributeType(utils.Ptr(testBackend)),
249242
}),
250243
},
251244
}

internal/cmd/beta/kms/wrappingkey/delete/delete.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
7676
}
7777

7878
// Wait for async operation not relevant. Wrapping key deletion is synchronous
79-
// https://pkg.go.dev/github.com/stackitcloud/stackit-sdk-go/services/kms@v0.5.1/wait
80-
8179
params.Printer.Info("Deleted wrapping key %q\n", wrappingKeyName)
8280
return nil
8381
},

0 commit comments

Comments
 (0)