Skip to content

Commit f72dc31

Browse files
Generator: Update SDK /services/postgresflex (#1488)
* Generate postgresflex * Update tests and waiter with the new region parameter * Update CHANGELOG --------- Co-authored-by: Marcel Jacek <[email protected]>
1 parent 6fb6fd1 commit f72dc31

File tree

66 files changed

+762
-255
lines changed

Some content is hidden

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

66 files changed

+762
-255
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
- **Feature:** Add method to create inquiries: `InquiriesCreateInquiry`
55
- **Feature:** Add `sort` property to `ApiListCatalogProductsRequest`
66
- **Feature:** Add payload `ApproveSubscriptionPayload` for `ApiApproveSubscriptionRequest`
7+
- `postgresflex`: [v1.0.0](services/postgresflex/CHANGELOG.md#v100-2025-02-24)
8+
- **Breaking Change:** The region is no longer specified within the client configuration. Instead, the region must be passed as a parameter to any region-specific request.
79

810
## Release (2025-02-21)
911
> [!WARNING]

examples/postgresflex/go.mod

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

33
go 1.21
44

5-
require (
6-
github.com/stackitcloud/stackit-sdk-go/core v0.16.0
7-
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.18.0
8-
)
5+
require github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.18.0
96

107
require (
118
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
129
github.com/google/go-cmp v0.7.0 // indirect
1310
github.com/google/uuid v1.6.0 // indirect
11+
github.com/stackitcloud/stackit-sdk-go/core v0.16.0 // indirect
1412
)

examples/postgresflex/postgresflex.go

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

8-
"github.com/stackitcloud/stackit-sdk-go/core/config"
98
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex"
109
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex/wait"
1110
)
@@ -14,17 +13,18 @@ func main() {
1413
// Specify the project ID
1514
projectId := "PROJECT_ID"
1615

16+
// Specify the region
17+
region := "REGION"
18+
1719
// Create a new API client, that uses default authentication and configuration
18-
postgresflexClient, err := postgresflex.NewAPIClient(
19-
config.WithRegion("eu01"),
20-
)
20+
postgresflexClient, err := postgresflex.NewAPIClient()
2121
if err != nil {
2222
fmt.Fprintf(os.Stderr, "Creating API client: %v\n", err)
2323
os.Exit(1)
2424
}
2525

2626
// Get the postgresql instances for your project
27-
getInstancesResp, err := postgresflexClient.ListInstances(context.Background(), projectId).Execute()
27+
getInstancesResp, err := postgresflexClient.ListInstances(context.Background(), projectId, region).Execute()
2828
if err != nil {
2929
fmt.Fprintf(os.Stderr, "Error when calling `ListInstances`: %v\n", err)
3030
os.Exit(1)
@@ -44,7 +44,7 @@ func main() {
4444
Username: &username,
4545
Roles: &[]string{"login"},
4646
}
47-
_, err = postgresflexClient.CreateUser(context.Background(), projectId, instanceId).CreateUserPayload(createUserPayload).Execute()
47+
_, err = postgresflexClient.CreateUser(context.Background(), projectId, region, instanceId).CreateUserPayload(createUserPayload).Execute()
4848
if err != nil {
4949
fmt.Fprintf(os.Stderr, "Error when calling `CreateUser`: %v\n", err)
5050
os.Exit(1)
@@ -53,27 +53,27 @@ func main() {
5353
fmt.Printf("Created user \"%s\" associated to instance \"%s\".\n", username, *items[0].Name)
5454

5555
// Delete an instance
56-
err = postgresflexClient.DeleteInstance(context.Background(), projectId, instanceId).Execute()
56+
err = postgresflexClient.DeleteInstance(context.Background(), projectId, region, instanceId).Execute()
5757

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

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

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

6969
// Force delete an instance
70-
err = postgresflexClient.ForceDeleteInstance(context.Background(), projectId, instanceId).Execute()
70+
err = postgresflexClient.ForceDeleteInstance(context.Background(), projectId, region, instanceId).Execute()
7171

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

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

examples/runtime/runtime.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"net/http"
77
"os"
88

9-
"github.com/stackitcloud/stackit-sdk-go/core/config"
109
"github.com/stackitcloud/stackit-sdk-go/core/runtime"
1110
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex"
1211
)
@@ -15,30 +14,31 @@ func main() {
1514
// Specify the project ID
1615
projectId := "PROJECT_ID"
1716

17+
// Specify the region
18+
region := "REGION"
19+
1820
// Create a new API client, that uses default authentication and configuration
19-
postgresflexClient, err := postgresflex.NewAPIClient(
20-
config.WithRegion("eu01"),
21-
)
21+
postgresflexClient, err := postgresflex.NewAPIClient()
2222
if err != nil {
2323
fmt.Fprintf(os.Stderr, "Creating API client: %v\n", err)
2424
os.Exit(1)
2525
}
2626

27-
// Get the MongoDB Flex instances for your project and capture the HTTP response using the context
27+
// Get the PostgreSQL Flex instances for your project and capture the HTTP response using the context
2828
var httpResp *http.Response
2929
ctxWithHTTPResp := runtime.WithCaptureHTTPResponse(context.Background(), &httpResp)
30-
getInstancesResp, err := postgresflexClient.ListInstances(ctxWithHTTPResp, projectId).Execute()
30+
getInstancesResp, err := postgresflexClient.ListInstances(ctxWithHTTPResp, projectId, region).Execute()
3131
if err != nil {
3232
fmt.Fprintf(os.Stderr, "Error when calling `ListInstances`: %v\n", err)
3333
os.Exit(1)
3434
}
3535
fmt.Printf("Number of instances: %v\n\n", len(*getInstancesResp.Items))
3636
fmt.Printf("HTTP response: %+v\n\n", *httpResp)
3737

38-
// Get the MongoDB Flex instances for your project and capture the HTTP request using the context
38+
// Get the PostgreSQL Flex instances for your project and capture the HTTP request using the context
3939
var httpReq *http.Request
4040
ctxWithHTTPReq := runtime.WithCaptureHTTPRequest(context.Background(), &httpReq)
41-
getInstancesResp, err = postgresflexClient.ListInstances(ctxWithHTTPReq, projectId).Execute()
41+
getInstancesResp, err = postgresflexClient.ListInstances(ctxWithHTTPReq, projectId, region).Execute()
4242
if err != nil {
4343
fmt.Fprintf(os.Stderr, "Error when calling `ListInstances`: %v\n", err)
4444
os.Exit(1)

services/postgresflex/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v1.0.0 (2025-02-24)
2+
- **Breaking Change:** The region is no longer specified within the client configuration. Instead, the region must be passed as a parameter to any region-specific request.
3+
14
## v0.18.0 (2025-02-21)
25
- **New:** Minimal go version is now Go 1.21
36

0 commit comments

Comments
 (0)