Skip to content
Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Release (2025-XX-XX)
- `mongodbflex`: [v1.4.0](services/mongodbflex/CHANGELOG.md#v140)
- **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.

## Release (2025-07-07)

- `ske`: [v1.0.0](services/ske/CHANGELOG.md#v100)
Expand Down
16 changes: 8 additions & 8 deletions examples/mongodbflex/mongodbflex.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"os"

"github.com/stackitcloud/stackit-sdk-go/core/config"
"github.com/stackitcloud/stackit-sdk-go/core/utils"
"github.com/stackitcloud/stackit-sdk-go/services/mongodbflex"
"github.com/stackitcloud/stackit-sdk-go/services/mongodbflex/wait"
Expand All @@ -15,17 +14,18 @@ func main() {
// Specify the project ID
projectId := "PROJECT_ID"

// Specify the region
region := "REGION"

// Create a new API client, that uses default authentication and configuration
mongodbflexClient, err := mongodbflex.NewAPIClient(
config.WithRegion("eu01"),
)
mongodbflexClient, err := mongodbflex.NewAPIClient()
if err != nil {
fmt.Fprintf(os.Stderr, "Creating API client: %v\n", err)
os.Exit(1)
}

// Get the MongoDB Flex instances for your project
getInstancesResp, err := mongodbflexClient.ListInstances(context.Background(), projectId).Tag("tag").Execute()
getInstancesResp, err := mongodbflexClient.ListInstances(context.Background(), projectId, region).Tag("tag").Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ListInstances`: %v\n", err)
os.Exit(1)
Expand All @@ -46,7 +46,7 @@ func main() {
Database: utils.Ptr("default"),
Roles: &[]string{"read"},
}
_, err = mongodbflexClient.CreateUser(context.Background(), projectId, instanceId).CreateUserPayload(createUserPayload).Execute()
_, err = mongodbflexClient.CreateUser(context.Background(), projectId, instanceId, region).CreateUserPayload(createUserPayload).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CreateUser`: %v\n", err)
os.Exit(1)
Expand All @@ -59,15 +59,15 @@ func main() {
BackupId: utils.Ptr("BACKUP_ID"),
InstanceId: &instanceId,
}
_, err = mongodbflexClient.RestoreInstance(context.Background(), projectId, instanceId).RestoreInstancePayload(restoreInstancePayload).Execute()
_, err = mongodbflexClient.RestoreInstance(context.Background(), projectId, instanceId, region).RestoreInstancePayload(restoreInstancePayload).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `RestoreInstance`: %v\n", err)
os.Exit(1)
}

fmt.Printf("Restoring instance \"%s\" from backup \"%s\".\n", instanceId, "BACKUP_ID")

_, err = wait.RestoreInstanceWaitHandler(context.Background(), mongodbflexClient, projectId, instanceId, "BACKUP_ID").WaitWithContext(context.Background())
_, err = wait.RestoreInstanceWaitHandler(context.Background(), mongodbflexClient, projectId, instanceId, "BACKUP_ID", region).WaitWithContext(context.Background())
if err != nil {
fmt.Fprintf(os.Stderr, "Error when waiting for restore to finish: %v\n", err)
os.Exit(1)
Expand Down
3 changes: 3 additions & 0 deletions services/mongodbflex/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v1.4.0
- **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.

## v1.3.0
- Add `required:"true"` tags to model structs

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