Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
- `vpn`: [v0.1.0](services/vpn/CHANGELOG.md#v010)
- **New:** SDK module for vpn service
- `v1alpha1api`: New package which can be used for communication with the vpn v1 alpha1 API
- `postgresflex`: [v1.4.0](services/postgresflex/CHANGELOG.md#v140)
- **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
- `v1api`: New package which can be used for communication with the postgresflex v1 API
- `v2api`: New package which can be used for communication with the postgresflex v1 API
- `v3alpha1api`: New package which can be used for communication with the postgresflex v3 alpha1 API
- **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.
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`

## Release (2026-02-20)
- `core`: [v0.21.1](core/CHANGELOG.md#v0211)
Expand Down
5 changes: 4 additions & 1 deletion examples/postgresflex/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ module github.com/stackitcloud/stackit-sdk-go/examples/postgresflex

go 1.21

// 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.
replace github.com/stackitcloud/stackit-sdk-go/services/postgresflex => ../../services/postgresflex

require github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.3.5

require (
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/stackitcloud/stackit-sdk-go/core v0.21.1 // indirect
github.com/stackitcloud/stackit-sdk-go/core v0.22.0 // indirect
)
6 changes: 2 additions & 4 deletions examples/postgresflex/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/stackitcloud/stackit-sdk-go/core v0.21.1 h1:Y/PcAgM7DPYMNqum0MLv4n1mF9ieuevzcCIZYQfm3Ts=
github.com/stackitcloud/stackit-sdk-go/core v0.21.1/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI=
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.3.5 h1:H67e3KnHQx954yI8fuQmxXwRf/myqAdLg2KvxImp00g=
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.3.5/go.mod h1:xmAWk9eom8wznvLuLfm0F4xyeiBX8LaggXsKFmos+dw=
github.com/stackitcloud/stackit-sdk-go/core v0.22.0 h1:6rViz7GnNwXSh51Lur5xuDzO8EWSZfN9J0HvEkBKq6c=
github.com/stackitcloud/stackit-sdk-go/core v0.22.0/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI=
20 changes: 10 additions & 10 deletions examples/postgresflex/postgresflex.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"os"

"github.com/stackitcloud/stackit-sdk-go/services/postgresflex"
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex/wait"
postgresflex "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v2api"
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v2api/wait"
)

func main() {
Expand All @@ -23,12 +23,12 @@ func main() {
}

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

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

// Delete an instance
err = postgresflexClient.DeleteInstance(context.Background(), projectId, region, instanceId).Execute()
err = postgresflexClient.DefaultAPI.DeleteInstance(context.Background(), projectId, region, instanceId).Execute()

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

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

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

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

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

_, err = wait.ForceDeleteInstanceWaitHandler(context.Background(), postgresflexClient, projectId, region, instanceId).WaitWithContext(context.Background())
_, err = wait.ForceDeleteInstanceWaitHandler(context.Background(), postgresflexClient.DefaultAPI, projectId, region, instanceId).WaitWithContext(context.Background())
if err != nil {
fmt.Fprintf(os.Stderr, "Error when waiting for PostgreSQL Flex instance force deletion: %v", err)
}
Expand Down
5 changes: 4 additions & 1 deletion examples/runtime/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ module github.com/stackitcloud/stackit-sdk-go/examples/runtime

go 1.21

// 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.
replace github.com/stackitcloud/stackit-sdk-go/services/postgresflex => ../../services/postgresflex

require (
github.com/stackitcloud/stackit-sdk-go/core v0.21.1
github.com/stackitcloud/stackit-sdk-go/core v0.22.0
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.3.5
)

Expand Down
6 changes: 2 additions & 4 deletions examples/runtime/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/stackitcloud/stackit-sdk-go/core v0.21.1 h1:Y/PcAgM7DPYMNqum0MLv4n1mF9ieuevzcCIZYQfm3Ts=
github.com/stackitcloud/stackit-sdk-go/core v0.21.1/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI=
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.3.5 h1:H67e3KnHQx954yI8fuQmxXwRf/myqAdLg2KvxImp00g=
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.3.5/go.mod h1:xmAWk9eom8wznvLuLfm0F4xyeiBX8LaggXsKFmos+dw=
github.com/stackitcloud/stackit-sdk-go/core v0.22.0 h1:6rViz7GnNwXSh51Lur5xuDzO8EWSZfN9J0HvEkBKq6c=
github.com/stackitcloud/stackit-sdk-go/core v0.22.0/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI=
10 changes: 5 additions & 5 deletions examples/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"

"github.com/stackitcloud/stackit-sdk-go/core/runtime"
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex"
postgresflex "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v2api"
)

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

// Get the PostgreSQL Flex instances for your project and capture the HTTP request using the context
var httpReq *http.Request
ctxWithHTTPReq := runtime.WithCaptureHTTPRequest(context.Background(), &httpReq)
getInstancesResp, err = postgresflexClient.ListInstances(ctxWithHTTPReq, projectId, region).Execute()
getInstancesResp, err = postgresflexClient.DefaultAPI.ListInstances(ctxWithHTTPReq, projectId, region).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ListInstances`: %v\n", err)
os.Exit(1)
}
fmt.Printf("Number of instances: %v\n\n", len(*getInstancesResp.Items))
fmt.Printf("Number of instances: %v\n\n", len(getInstancesResp.Items))
fmt.Printf("HTTP request: %+v\n\n", *httpReq)
}
8 changes: 8 additions & 0 deletions services/postgresflex/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## v1.4.0
- **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
- `v1api`: New package which can be used for communication with the postgresflex v1 API
- `v2api`: New package which can be used for communication with the postgresflex v1 API
- `v3alpha1api`: New package which can be used for communication with the postgresflex v3 alpha1 API
- **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.
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`

## v1.3.5
- Bump STACKIT SDK core module from `v0.21.0` to `v0.21.1`

Expand Down
2 changes: 1 addition & 1 deletion services/postgresflex/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.3.5
v1.4.0
Loading
Loading