Skip to content

Commit 8ed1361

Browse files
feat(postgresflex): add multi API version support (#5409)
relates to STACKITSDK-348 Co-authored-by: Ruben Hoenle <Ruben.Hoenle@stackit.cloud>
1 parent e358994 commit 8ed1361

File tree

268 files changed

+56410
-78
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

268 files changed

+56410
-78
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@
3232
- `vpn`: [v0.1.0](services/vpn/CHANGELOG.md#v010)
3333
- **New:** SDK module for vpn service
3434
- `v1alpha1api`: New package which can be used for communication with the vpn v1 alpha1 API
35+
- `postgresflex`: [v1.4.0](services/postgresflex/CHANGELOG.md#v140)
36+
- **Feature:** Introduction of multi API version support for the postgresflex SDK module. For more details please see the announcement on GitHub: https://github.com/stackitcloud/stackit-sdk-go/discussions/5062
37+
- `v1api`: New package which can be used for communication with the postgresflex v1 API
38+
- `v2api`: New package which can be used for communication with the postgresflex v1 API
39+
- `v3alpha1api`: New package which can be used for communication with the postgresflex v3 alpha1 API
40+
- **Deprecation:** The contents in the root of this SDK module including the `wait` package are marked as deprecated and will be removed after 2026-09-30. Switch to the new packages for the available API versions instead.
41+
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
3542

3643
## Release (2026-02-20)
3744
- `core`: [v0.21.1](core/CHANGELOG.md#v0211)

examples/postgresflex/go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ module github.com/stackitcloud/stackit-sdk-go/examples/postgresflex
22

33
go 1.21
44

5+
// This is not needed in production. This is only here to point the golangci linter to the local version instead of the last release on GitHub.
6+
replace github.com/stackitcloud/stackit-sdk-go/services/postgresflex => ../../services/postgresflex
7+
58
require github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.3.5
69

710
require (
811
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
912
github.com/google/uuid v1.6.0 // indirect
10-
github.com/stackitcloud/stackit-sdk-go/core v0.21.1 // indirect
13+
github.com/stackitcloud/stackit-sdk-go/core v0.22.0 // indirect
1114
)

examples/postgresflex/go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
44
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
55
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
66
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
7-
github.com/stackitcloud/stackit-sdk-go/core v0.21.1 h1:Y/PcAgM7DPYMNqum0MLv4n1mF9ieuevzcCIZYQfm3Ts=
8-
github.com/stackitcloud/stackit-sdk-go/core v0.21.1/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI=
9-
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.3.5 h1:H67e3KnHQx954yI8fuQmxXwRf/myqAdLg2KvxImp00g=
10-
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.3.5/go.mod h1:xmAWk9eom8wznvLuLfm0F4xyeiBX8LaggXsKFmos+dw=
7+
github.com/stackitcloud/stackit-sdk-go/core v0.22.0 h1:6rViz7GnNwXSh51Lur5xuDzO8EWSZfN9J0HvEkBKq6c=
8+
github.com/stackitcloud/stackit-sdk-go/core v0.22.0/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI=

examples/postgresflex/postgresflex.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"fmt"
66
"os"
77

8-
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex"
9-
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex/wait"
8+
postgresflex "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v2api"
9+
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v2api/wait"
1010
)
1111

1212
func main() {
@@ -23,12 +23,12 @@ func main() {
2323
}
2424

2525
// Get the postgresql instances for your project
26-
getInstancesResp, err := postgresflexClient.ListInstances(context.Background(), projectId, region).Execute()
26+
getInstancesResp, err := postgresflexClient.DefaultAPI.ListInstances(context.Background(), projectId, region).Execute()
2727
if err != nil {
2828
fmt.Fprintf(os.Stderr, "Error when calling `ListInstances`: %v\n", err)
2929
os.Exit(1)
3030
}
31-
items := *getInstancesResp.Items
31+
items := getInstancesResp.Items
3232
fmt.Printf("Number of instances: %v\n", len(items))
3333

3434
// Create a user associated to an instance
@@ -41,9 +41,9 @@ func main() {
4141
username := "example-user"
4242
createUserPayload := postgresflex.CreateUserPayload{
4343
Username: &username,
44-
Roles: &[]string{"login"},
44+
Roles: []string{"login"},
4545
}
46-
_, err = postgresflexClient.CreateUser(context.Background(), projectId, region, instanceId).CreateUserPayload(createUserPayload).Execute()
46+
_, err = postgresflexClient.DefaultAPI.CreateUser(context.Background(), projectId, region, instanceId).CreateUserPayload(createUserPayload).Execute()
4747
if err != nil {
4848
fmt.Fprintf(os.Stderr, "Error when calling `CreateUser`: %v\n", err)
4949
os.Exit(1)
@@ -52,27 +52,27 @@ func main() {
5252
fmt.Printf("Created user \"%s\" associated to instance \"%s\".\n", username, *items[0].Name)
5353

5454
// Delete an instance
55-
err = postgresflexClient.DeleteInstance(context.Background(), projectId, region, instanceId).Execute()
55+
err = postgresflexClient.DefaultAPI.DeleteInstance(context.Background(), projectId, region, instanceId).Execute()
5656

5757
if err != nil {
5858
fmt.Fprintf(os.Stderr, "Error when delete PostgreSQL Flex instance: %v", err)
5959
}
6060

61-
_, err = wait.DeleteInstanceWaitHandler(context.Background(), postgresflexClient, projectId, region, instanceId).WaitWithContext(context.Background())
61+
_, err = wait.DeleteInstanceWaitHandler(context.Background(), postgresflexClient.DefaultAPI, projectId, region, instanceId).WaitWithContext(context.Background())
6262
if err != nil {
6363
fmt.Fprintf(os.Stderr, "Error when waiting for PostgreSQL Flex instance deletion: %v", err)
6464
}
6565

6666
fmt.Printf("Deleted PostgreSQL Flex instance \"%s\".\n", instanceId)
6767

6868
// Force delete an instance
69-
err = postgresflexClient.ForceDeleteInstance(context.Background(), projectId, region, instanceId).Execute()
69+
err = postgresflexClient.DefaultAPI.ForceDeleteInstance(context.Background(), projectId, region, instanceId).Execute()
7070

7171
if err != nil {
7272
fmt.Fprintf(os.Stderr, "Error when force delete PostgreSQL Flex instance: %v", err)
7373
}
7474

75-
_, err = wait.ForceDeleteInstanceWaitHandler(context.Background(), postgresflexClient, projectId, region, instanceId).WaitWithContext(context.Background())
75+
_, err = wait.ForceDeleteInstanceWaitHandler(context.Background(), postgresflexClient.DefaultAPI, projectId, region, instanceId).WaitWithContext(context.Background())
7676
if err != nil {
7777
fmt.Fprintf(os.Stderr, "Error when waiting for PostgreSQL Flex instance force deletion: %v", err)
7878
}

examples/runtime/go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ module github.com/stackitcloud/stackit-sdk-go/examples/runtime
22

33
go 1.21
44

5+
// This is not needed in production. This is only here to point the golangci linter to the local version instead of the last release on GitHub.
6+
replace github.com/stackitcloud/stackit-sdk-go/services/postgresflex => ../../services/postgresflex
7+
58
require (
6-
github.com/stackitcloud/stackit-sdk-go/core v0.21.1
9+
github.com/stackitcloud/stackit-sdk-go/core v0.22.0
710
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.3.5
811
)
912

examples/runtime/go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
44
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
55
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
66
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
7-
github.com/stackitcloud/stackit-sdk-go/core v0.21.1 h1:Y/PcAgM7DPYMNqum0MLv4n1mF9ieuevzcCIZYQfm3Ts=
8-
github.com/stackitcloud/stackit-sdk-go/core v0.21.1/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI=
9-
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.3.5 h1:H67e3KnHQx954yI8fuQmxXwRf/myqAdLg2KvxImp00g=
10-
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.3.5/go.mod h1:xmAWk9eom8wznvLuLfm0F4xyeiBX8LaggXsKFmos+dw=
7+
github.com/stackitcloud/stackit-sdk-go/core v0.22.0 h1:6rViz7GnNwXSh51Lur5xuDzO8EWSZfN9J0HvEkBKq6c=
8+
github.com/stackitcloud/stackit-sdk-go/core v0.22.0/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI=

examples/runtime/runtime.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"os"
88

99
"github.com/stackitcloud/stackit-sdk-go/core/runtime"
10-
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex"
10+
postgresflex "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v2api"
1111
)
1212

1313
func main() {
@@ -26,22 +26,22 @@ func main() {
2626
// Get the PostgreSQL Flex instances for your project and capture the HTTP response using the context
2727
var httpResp *http.Response
2828
ctxWithHTTPResp := runtime.WithCaptureHTTPResponse(context.Background(), &httpResp)
29-
getInstancesResp, err := postgresflexClient.ListInstances(ctxWithHTTPResp, projectId, region).Execute()
29+
getInstancesResp, err := postgresflexClient.DefaultAPI.ListInstances(ctxWithHTTPResp, projectId, region).Execute()
3030
if err != nil {
3131
fmt.Fprintf(os.Stderr, "Error when calling `ListInstances`: %v\n", err)
3232
os.Exit(1)
3333
}
34-
fmt.Printf("Number of instances: %v\n\n", len(*getInstancesResp.Items))
34+
fmt.Printf("Number of instances: %v\n\n", len(getInstancesResp.Items))
3535
fmt.Printf("HTTP response: %+v\n\n", *httpResp)
3636

3737
// Get the PostgreSQL Flex instances for your project and capture the HTTP request using the context
3838
var httpReq *http.Request
3939
ctxWithHTTPReq := runtime.WithCaptureHTTPRequest(context.Background(), &httpReq)
40-
getInstancesResp, err = postgresflexClient.ListInstances(ctxWithHTTPReq, projectId, region).Execute()
40+
getInstancesResp, err = postgresflexClient.DefaultAPI.ListInstances(ctxWithHTTPReq, projectId, region).Execute()
4141
if err != nil {
4242
fmt.Fprintf(os.Stderr, "Error when calling `ListInstances`: %v\n", err)
4343
os.Exit(1)
4444
}
45-
fmt.Printf("Number of instances: %v\n\n", len(*getInstancesResp.Items))
45+
fmt.Printf("Number of instances: %v\n\n", len(getInstancesResp.Items))
4646
fmt.Printf("HTTP request: %+v\n\n", *httpReq)
4747
}

services/postgresflex/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## v1.4.0
2+
- **Feature:** Introduction of multi API version support for the postgresflex SDK module. For more details please see the announcement on GitHub: https://github.com/stackitcloud/stackit-sdk-go/discussions/5062
3+
- `v1api`: New package which can be used for communication with the postgresflex v1 API
4+
- `v2api`: New package which can be used for communication with the postgresflex v1 API
5+
- `v3alpha1api`: New package which can be used for communication with the postgresflex v3 alpha1 API
6+
- **Deprecation:** The contents in the root of this SDK module including the `wait` package are marked as deprecated and will be removed after 2026-09-30. Switch to the new packages for the available API versions instead.
7+
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
8+
19
## v1.3.5
210
- Bump STACKIT SDK core module from `v0.21.0` to `v0.21.1`
311

services/postgresflex/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.3.5
1+
v1.4.0

0 commit comments

Comments
 (0)