Skip to content

Commit 6f985f0

Browse files
chore(deps): bump github.com/stackitcloud/stackit-sdk-go/services/postgresflex from 1.12.0 to 1.13.0 (#1575)
* chore(deps): bump github.com/stackitcloud/stackit-sdk-go/services/postgresflex Bumps [github.com/stackitcloud/stackit-sdk-go/services/postgresflex](https://github.com/stackitcloud/stackit-sdk-go) from 1.12.0 to 1.13.0. - [Release notes](https://github.com/stackitcloud/stackit-sdk-go/releases) - [Changelog](https://github.com/stackitcloud/stackit-sdk-go/blob/main/CHANGELOG.md) - [Commits](stackitcloud/stackit-sdk-go@services/cdn/v1.12.0...services/cdn/v1.13.0) --- updated-dependencies: - dependency-name: github.com/stackitcloud/stackit-sdk-go/services/postgresflex dependency-version: 1.13.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * fix(postgresflex): instance create/clone payloads made storage class required Added nil checks and pointer dereferences instead of making flags required. If flag is not passed, default will be used and a warning printed. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Carlo Goetz <carlo.goetz@inovex.de>
1 parent 3a38bc0 commit 6f985f0

6 files changed

Lines changed: 53 additions & 9 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ require (
2828
github.com/stackitcloud/stackit-sdk-go/services/logs v0.10.1
2929
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v1.12.1
3030
github.com/stackitcloud/stackit-sdk-go/services/opensearch v1.3.0
31-
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.12.0
31+
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.13.0
3232
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.24.2
3333
github.com/stackitcloud/stackit-sdk-go/services/runcommand v1.9.1
3434
github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.18.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,8 +628,8 @@ github.com/stackitcloud/stackit-sdk-go/services/observability v0.25.0 h1:r3URNI1
628628
github.com/stackitcloud/stackit-sdk-go/services/observability v0.25.0/go.mod h1:0fEZQHm729mBdvg4sNrAhM6KmHROHJSeS2FwCMRk46k=
629629
github.com/stackitcloud/stackit-sdk-go/services/opensearch v1.3.0 h1:j8327l7QFhdL4ETg3kV9Q7Jle5GFYtfxMkBS3IvalDo=
630630
github.com/stackitcloud/stackit-sdk-go/services/opensearch v1.3.0/go.mod h1:L+NlfC1hilLOqlLLukCj/UDnxlnNrc/oMikcw3Ansyw=
631-
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.12.0 h1:elIyrDVSYlEtigFO82SWnpfuJZdpv0b2SwvL3M+z9dA=
632-
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.12.0/go.mod h1:yzlakB+f8ur4yAHR6lyCABO+HcEtZG3G2Faj6m5/uW8=
631+
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.13.0 h1:o8+bH3763G5oU1Y8Bf5nkQ8kzqFO7su0VUpeSGKdoPY=
632+
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.13.0/go.mod h1:yzlakB+f8ur4yAHR6lyCABO+HcEtZG3G2Faj6m5/uW8=
633633
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v1.3.0 h1:jX0fN80M87/O8RVA+kNX1yioj+y30dHd6VrFC8OrRTA=
634634
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v1.3.0/go.mod h1:TwfVVynB/+AKbccSOLk2qZpPL1tdK43BBAiACP6EtSg=
635635
github.com/stackitcloud/stackit-sdk-go/services/redis v1.4.0 h1:/f1sItmKRplpM8Kaa5LMnmfUPvnlgu5Tf+HV0w57pV0=

internal/cmd/postgresflex/instance/clone/clone.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,13 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient postgresflex
176176
if model.StorageSize == nil {
177177
return postgresflex.ApiCloneInstanceRequest{}, fmt.Errorf("storage size is nil")
178178
}
179+
if model.StorageClass == nil {
180+
return postgresflex.ApiCloneInstanceRequest{}, fmt.Errorf("storage class is nil")
181+
}
179182

180183
payload := postgresflex.CloneInstancePayload{
181184
InstanceOverrides: postgresflex.CloneInstanceOverrides{
182-
Class: model.StorageClass,
185+
Class: *model.StorageClass,
183186
Size: *model.StorageSize,
184187
Name: model.InstanceName,
185188
},

internal/cmd/postgresflex/instance/clone/clone_test.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ func fixturePayload(mods ...func(payload *postgresflex.CloneInstancePayload)) po
130130

131131
payload := postgresflex.CloneInstancePayload{
132132
InstanceOverrides: postgresflex.CloneInstanceOverrides{
133-
Size: testStorageSize,
133+
Class: testStorageClass,
134+
Size: testStorageSize,
134135
},
135136
PointInTime: testRecoveryTimestamp,
136137
}
@@ -302,6 +303,7 @@ func TestBuildRequest(t *testing.T) {
302303
description: "base",
303304
model: fixtureRequiredInputModel(
304305
func(model *inputModel) {
306+
model.StorageClass = utils.Ptr(testStorageClass)
305307
model.StorageSize = utils.Ptr(testStorageSize)
306308
},
307309
),
@@ -318,7 +320,7 @@ func TestBuildRequest(t *testing.T) {
318320
expectedRequest: testClient.DefaultAPI.CloneInstance(testCtx, testProjectId, testRegion, testInstanceId).
319321
CloneInstancePayload(postgresflex.CloneInstancePayload{
320322
InstanceOverrides: postgresflex.CloneInstanceOverrides{
321-
Class: utils.Ptr("class"),
323+
Class: "class",
322324
Size: testStorageSize,
323325
},
324326
PointInTime: testRecoveryTimestamp,
@@ -327,10 +329,19 @@ func TestBuildRequest(t *testing.T) {
327329
{
328330
description: "storage size missing",
329331
model: fixtureRequiredInputModel(func(model *inputModel) {
332+
model.StorageClass = utils.Ptr(testStorageClass)
330333
model.StorageSize = nil
331334
}),
332335
isValid: false,
333336
},
337+
{
338+
description: "storage class missing",
339+
model: fixtureRequiredInputModel(func(model *inputModel) {
340+
model.StorageClass = nil
341+
model.StorageSize = utils.Ptr(testStorageSize)
342+
}),
343+
isValid: false,
344+
},
334345
{
335346
description: "specify storage class and size",
336347
model: fixtureRequiredInputModel(func(model *inputModel) {
@@ -341,7 +352,7 @@ func TestBuildRequest(t *testing.T) {
341352
expectedRequest: testClient.DefaultAPI.CloneInstance(testCtx, testProjectId, testRegion, testInstanceId).
342353
CloneInstancePayload(postgresflex.CloneInstancePayload{
343354
InstanceOverrides: postgresflex.CloneInstanceOverrides{
344-
Class: utils.Ptr("class"),
355+
Class: "class",
345356
Size: int64(10),
346357
},
347358
PointInTime: testRecoveryTimestamp,

internal/cmd/postgresflex/instance/create/create.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient postgresflex
350350
return postgresflex.ApiCreateInstanceRequest{}, fmt.Errorf("storage size is nil")
351351
} else if model.Version == nil {
352352
return postgresflex.ApiCreateInstanceRequest{}, fmt.Errorf("version is nil")
353+
} else if model.StorageClass == nil {
354+
return postgresflex.ApiCreateInstanceRequest{}, fmt.Errorf("storage class is nil")
353355
}
354356

355357
req = req.CreateInstancePayload(postgresflex.CreateInstancePayload{
@@ -363,7 +365,7 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient postgresflex
363365
},
364366
RetentionDays: *postgresflex.NewNullableInt32(model.RetentionDays),
365367
Storage: postgresflex.StorageCreate{
366-
Class: model.StorageClass,
368+
Class: *model.StorageClass,
367369
Size: *model.StorageSize,
368370
},
369371
Version: *model.Version,

internal/cmd/postgresflex/instance/create/create_test.go

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func fixturePayload(mods ...func(payload *postgresflex.CreateInstancePayload)) p
8383
Acl: []string{"0.0.0.0/0"},
8484
},
8585
Storage: postgresflex.StorageCreate{
86-
Class: utils.Ptr("premium-perf4-stackit"),
86+
Class: "premium-perf4-stackit",
8787
Size: int64(10),
8888
},
8989
Version: "6.0",
@@ -271,6 +271,34 @@ func TestBuildRequest(t *testing.T) {
271271
*request = request.CreateInstancePayload(payload)
272272
}),
273273
},
274+
{
275+
description: "storage class missing",
276+
model: fixtureInputModel(func(model *inputModel) {
277+
model.StorageClass = nil
278+
}),
279+
isValid: false,
280+
},
281+
{
282+
description: "storage size missing",
283+
model: fixtureInputModel(func(model *inputModel) {
284+
model.StorageSize = nil
285+
}),
286+
isValid: false,
287+
},
288+
{
289+
description: "backup schedule missing",
290+
model: fixtureInputModel(func(model *inputModel) {
291+
model.BackupSchedule = nil
292+
}),
293+
isValid: false,
294+
},
295+
{
296+
description: "version missing",
297+
model: fixtureInputModel(func(model *inputModel) {
298+
model.Version = nil
299+
}),
300+
isValid: false,
301+
},
274302
}
275303

276304
for _, tt := range tests {

0 commit comments

Comments
 (0)