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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
- **Feature:** Add payload `ApproveSubscriptionPayload` for `ApiApproveSubscriptionRequest`
- `postgresflex`: [v1.0.0](services/postgresflex/CHANGELOG.md#v100-2025-02-24)
- **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.
- `sqlserverflex`: [v1.0.0](services/sqlserverflex/CHANGELOG.md#v100-2025-02-25)
- **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.
- **Feature:** Add method to delete all instances for a project: `TerminateProject`

## Release (2025-02-21)
> [!WARNING]
Expand Down
18 changes: 9 additions & 9 deletions examples/sqlserverflex/sqlserverflex.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/sqlserverflex"
"github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex/wait"
Expand All @@ -15,23 +14,24 @@ func main() {
// Specify the project ID
projectId := "PROJECT_ID"

// Specify the region
region := "REGION"

// Specify instance configuration options
flavorId := "FLAVOR_ID"
version := "VERSION"

ctx := context.Background()

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

// Get the SQLServer Flex instances for your project
getInstancesResp, err := sqlserverflexClient.ListInstances(ctx, projectId).Execute()
getInstancesResp, err := sqlserverflexClient.ListInstances(ctx, projectId, region).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ListInstances`: %v\n", err)
os.Exit(1)
Expand All @@ -45,27 +45,27 @@ func main() {
FlavorId: utils.Ptr(flavorId),
Version: utils.Ptr(version),
}
instance, err := sqlserverflexClient.CreateInstance(ctx, projectId).CreateInstancePayload(createInstancePayload).Execute()
instance, err := sqlserverflexClient.CreateInstance(ctx, projectId, region).CreateInstancePayload(createInstancePayload).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error creating SQL Server Flex instance: %v\n", err)
}
instanceId := *instance.Id

_, err = wait.CreateInstanceWaitHandler(ctx, sqlserverflexClient, projectId, instanceId).WaitWithContext(ctx)
_, err = wait.CreateInstanceWaitHandler(ctx, sqlserverflexClient, projectId, instanceId, region).WaitWithContext(ctx)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when waiting for SQL Server Flex instance creation: %v\n", err)
}

fmt.Printf("Created SQL Server Flex instance \"%s\".\n", instanceId)

// Delete an instance
err = sqlserverflexClient.DeleteInstance(ctx, projectId, instanceId).Execute()
err = sqlserverflexClient.DeleteInstance(ctx, projectId, instanceId, region).Execute()

if err != nil {
fmt.Fprintf(os.Stderr, "Error deleting SQL Server Flex instance: %v\n", err)
}

_, err = wait.DeleteInstanceWaitHandler(ctx, sqlserverflexClient, projectId, instanceId).WaitWithContext(ctx)
_, err = wait.DeleteInstanceWaitHandler(ctx, sqlserverflexClient, projectId, instanceId, region).WaitWithContext(ctx)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when waiting for SQL Server Flex instance deletion: %v\n", err)
}
Expand Down
4 changes: 4 additions & 0 deletions services/sqlserverflex/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v1.0.0 (2025-02-25)
- **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.
- **Feature:** Add method to delete all instances for a project: `TerminateProject`

## v0.10.0 (2025-02-21)
- **New:** Minimal go version is now Go 1.21

Expand Down
Loading
Loading