From a2e1e9df219a58321007642d9e39e89a08f208fd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Aug 2026 14:22:20 +0000 Subject: [PATCH 1/2] 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](https://github.com/stackitcloud/stackit-sdk-go/compare/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] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a88b8a481..916453c27 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/stackitcloud/stackit-sdk-go/services/logs v0.10.1 github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v1.12.1 github.com/stackitcloud/stackit-sdk-go/services/opensearch v1.3.0 - github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.12.0 + github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.13.0 github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.24.2 github.com/stackitcloud/stackit-sdk-go/services/runcommand v1.9.1 github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.18.2 diff --git a/go.sum b/go.sum index d3cdeec2d..854729b5f 100644 --- a/go.sum +++ b/go.sum @@ -628,8 +628,8 @@ github.com/stackitcloud/stackit-sdk-go/services/observability v0.25.0 h1:r3URNI1 github.com/stackitcloud/stackit-sdk-go/services/observability v0.25.0/go.mod h1:0fEZQHm729mBdvg4sNrAhM6KmHROHJSeS2FwCMRk46k= github.com/stackitcloud/stackit-sdk-go/services/opensearch v1.3.0 h1:j8327l7QFhdL4ETg3kV9Q7Jle5GFYtfxMkBS3IvalDo= github.com/stackitcloud/stackit-sdk-go/services/opensearch v1.3.0/go.mod h1:L+NlfC1hilLOqlLLukCj/UDnxlnNrc/oMikcw3Ansyw= -github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.12.0 h1:elIyrDVSYlEtigFO82SWnpfuJZdpv0b2SwvL3M+z9dA= -github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.12.0/go.mod h1:yzlakB+f8ur4yAHR6lyCABO+HcEtZG3G2Faj6m5/uW8= +github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.13.0 h1:o8+bH3763G5oU1Y8Bf5nkQ8kzqFO7su0VUpeSGKdoPY= +github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.13.0/go.mod h1:yzlakB+f8ur4yAHR6lyCABO+HcEtZG3G2Faj6m5/uW8= github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v1.3.0 h1:jX0fN80M87/O8RVA+kNX1yioj+y30dHd6VrFC8OrRTA= github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v1.3.0/go.mod h1:TwfVVynB/+AKbccSOLk2qZpPL1tdK43BBAiACP6EtSg= github.com/stackitcloud/stackit-sdk-go/services/redis v1.4.0 h1:/f1sItmKRplpM8Kaa5LMnmfUPvnlgu5Tf+HV0w57pV0= From af6eedc50f03e37121723f4a38c5a8f3218ecee6 Mon Sep 17 00:00:00 2001 From: Carlo Goetz Date: Mon, 31 Aug 2026 14:59:57 +0200 Subject: [PATCH 2/2] 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. --- .../cmd/postgresflex/instance/clone/clone.go | 5 +++- .../postgresflex/instance/clone/clone_test.go | 17 +++++++++-- .../postgresflex/instance/create/create.go | 4 ++- .../instance/create/create_test.go | 30 ++++++++++++++++++- 4 files changed, 50 insertions(+), 6 deletions(-) diff --git a/internal/cmd/postgresflex/instance/clone/clone.go b/internal/cmd/postgresflex/instance/clone/clone.go index 6579e0a43..f6d3d2100 100644 --- a/internal/cmd/postgresflex/instance/clone/clone.go +++ b/internal/cmd/postgresflex/instance/clone/clone.go @@ -176,10 +176,13 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient postgresflex if model.StorageSize == nil { return postgresflex.ApiCloneInstanceRequest{}, fmt.Errorf("storage size is nil") } + if model.StorageClass == nil { + return postgresflex.ApiCloneInstanceRequest{}, fmt.Errorf("storage class is nil") + } payload := postgresflex.CloneInstancePayload{ InstanceOverrides: postgresflex.CloneInstanceOverrides{ - Class: model.StorageClass, + Class: *model.StorageClass, Size: *model.StorageSize, Name: model.InstanceName, }, diff --git a/internal/cmd/postgresflex/instance/clone/clone_test.go b/internal/cmd/postgresflex/instance/clone/clone_test.go index 5c8d69e9c..fbd2cdbc7 100644 --- a/internal/cmd/postgresflex/instance/clone/clone_test.go +++ b/internal/cmd/postgresflex/instance/clone/clone_test.go @@ -130,7 +130,8 @@ func fixturePayload(mods ...func(payload *postgresflex.CloneInstancePayload)) po payload := postgresflex.CloneInstancePayload{ InstanceOverrides: postgresflex.CloneInstanceOverrides{ - Size: testStorageSize, + Class: testStorageClass, + Size: testStorageSize, }, PointInTime: testRecoveryTimestamp, } @@ -302,6 +303,7 @@ func TestBuildRequest(t *testing.T) { description: "base", model: fixtureRequiredInputModel( func(model *inputModel) { + model.StorageClass = utils.Ptr(testStorageClass) model.StorageSize = utils.Ptr(testStorageSize) }, ), @@ -318,7 +320,7 @@ func TestBuildRequest(t *testing.T) { expectedRequest: testClient.DefaultAPI.CloneInstance(testCtx, testProjectId, testRegion, testInstanceId). CloneInstancePayload(postgresflex.CloneInstancePayload{ InstanceOverrides: postgresflex.CloneInstanceOverrides{ - Class: utils.Ptr("class"), + Class: "class", Size: testStorageSize, }, PointInTime: testRecoveryTimestamp, @@ -327,10 +329,19 @@ func TestBuildRequest(t *testing.T) { { description: "storage size missing", model: fixtureRequiredInputModel(func(model *inputModel) { + model.StorageClass = utils.Ptr(testStorageClass) model.StorageSize = nil }), isValid: false, }, + { + description: "storage class missing", + model: fixtureRequiredInputModel(func(model *inputModel) { + model.StorageClass = nil + model.StorageSize = utils.Ptr(testStorageSize) + }), + isValid: false, + }, { description: "specify storage class and size", model: fixtureRequiredInputModel(func(model *inputModel) { @@ -341,7 +352,7 @@ func TestBuildRequest(t *testing.T) { expectedRequest: testClient.DefaultAPI.CloneInstance(testCtx, testProjectId, testRegion, testInstanceId). CloneInstancePayload(postgresflex.CloneInstancePayload{ InstanceOverrides: postgresflex.CloneInstanceOverrides{ - Class: utils.Ptr("class"), + Class: "class", Size: int64(10), }, PointInTime: testRecoveryTimestamp, diff --git a/internal/cmd/postgresflex/instance/create/create.go b/internal/cmd/postgresflex/instance/create/create.go index b84bfd741..3f56f04b1 100644 --- a/internal/cmd/postgresflex/instance/create/create.go +++ b/internal/cmd/postgresflex/instance/create/create.go @@ -350,6 +350,8 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient postgresflex return postgresflex.ApiCreateInstanceRequest{}, fmt.Errorf("storage size is nil") } else if model.Version == nil { return postgresflex.ApiCreateInstanceRequest{}, fmt.Errorf("version is nil") + } else if model.StorageClass == nil { + return postgresflex.ApiCreateInstanceRequest{}, fmt.Errorf("storage class is nil") } req = req.CreateInstancePayload(postgresflex.CreateInstancePayload{ @@ -363,7 +365,7 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient postgresflex }, RetentionDays: *postgresflex.NewNullableInt32(model.RetentionDays), Storage: postgresflex.StorageCreate{ - Class: model.StorageClass, + Class: *model.StorageClass, Size: *model.StorageSize, }, Version: *model.Version, diff --git a/internal/cmd/postgresflex/instance/create/create_test.go b/internal/cmd/postgresflex/instance/create/create_test.go index b87ca93e7..f4c41a220 100644 --- a/internal/cmd/postgresflex/instance/create/create_test.go +++ b/internal/cmd/postgresflex/instance/create/create_test.go @@ -83,7 +83,7 @@ func fixturePayload(mods ...func(payload *postgresflex.CreateInstancePayload)) p Acl: []string{"0.0.0.0/0"}, }, Storage: postgresflex.StorageCreate{ - Class: utils.Ptr("premium-perf4-stackit"), + Class: "premium-perf4-stackit", Size: int64(10), }, Version: "6.0", @@ -271,6 +271,34 @@ func TestBuildRequest(t *testing.T) { *request = request.CreateInstancePayload(payload) }), }, + { + description: "storage class missing", + model: fixtureInputModel(func(model *inputModel) { + model.StorageClass = nil + }), + isValid: false, + }, + { + description: "storage size missing", + model: fixtureInputModel(func(model *inputModel) { + model.StorageSize = nil + }), + isValid: false, + }, + { + description: "backup schedule missing", + model: fixtureInputModel(func(model *inputModel) { + model.BackupSchedule = nil + }), + isValid: false, + }, + { + description: "version missing", + model: fixtureInputModel(func(model *inputModel) { + model.Version = nil + }), + isValid: false, + }, } for _, tt := range tests {