Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
- `postgresflex`: [v1.3.0](services/postgresflex/CHANGELOG.md#v130)
- **Breaking Change:** The attribute type for `PartialUpdateInstancePayload` and `UpdateInstancePayload` changed from `Storage` to `StorageUpdate`.
- **Deprecation:** `StorageUpdate`: updating the performance class field is not possible.
- `iaas`: [v1.0.0](services/iaas/CHANGELOG.md#v100)
- **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 new methods to manage routing tables: `AddRoutingTableToArea`, `DeleteRoutingTableFromArea`, `GetRoutingTableOfArea`, `ListRoutingTablesOfArea` and `UpdateRoutingTableOfArea`
- **Feature:** Add new methods to manage routes in routing tables: `AddRoutesToRoutingTable`, `DeleteRouteFromRoutingTable`, `GetRouteOfRoutingTable`, `ListRoutesOfRoutingTable` and `UpdateRouteOfRoutingTable`
- **Breaking Change:** Add new method to manage network area regions: `CreateNetworkAreaRegion`, `DeleteNetworkAreaRegion`, `GetNetworkAreaRegion`, `ListNetworkAreaRegions` and `UpdateNetworkAreaRegion`
- **Feature:** Add new wait handler for network area region: `CreateNetworkAreaRegionWaitHandler` and `DeleteRegionalNetworkAreaConfigurationWaitHandler`
- **Deprecated:** Deprecated wait handler and will be removed after April 2026: `CreateNetworkAreaWaitHandler`, `UpdateNetworkAreaWaitHandler` and `DeleteNetworkAreaWaitHandler`
- Migrate iaas examples to the new iaas methods

## Release (2025-10-13)
- `observability`: [v0.15.0](services/observability/CHANGELOG.md#v0150)
Expand Down
16 changes: 7 additions & 9 deletions examples/iaas/attach_nic/attach_nic.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,20 @@ import (
"net/http"
"os"

"github.com/stackitcloud/stackit-sdk-go/core/config"
"github.com/stackitcloud/stackit-sdk-go/core/runtime"
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
)

func main() {
// Specify the organization ID and project ID
// Specify the project ID, server ID, nic ID and region
projectId := "PROJECT_ID" // the uuid of your STACKIT project
serverId := "SERVER_ID"
nicId := "NIC_ID"
region := "eu01"

// Create a new API client, that uses default authentication and configuration
iaasClient, err := iaas.NewAPIClient(
config.WithRegion("eu01"),
)
iaasClient, err := iaas.NewAPIClient()
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Creating API client: %v\n", err)
os.Exit(1)
Expand All @@ -30,7 +28,7 @@ func main() {
// Attach an existing network interface to an existing server
var httpResp *http.Response
ctxWithHTTPResp := runtime.WithCaptureHTTPResponse(context.Background(), &httpResp)
err = iaasClient.AddNicToServer(ctxWithHTTPResp, projectId, serverId, nicId).Execute()
err = iaasClient.AddNicToServer(ctxWithHTTPResp, projectId, region, serverId, nicId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when calling `AddNICToServer`: %v\n", err)
} else {
Expand All @@ -39,15 +37,15 @@ func main() {
requestId := httpResp.Header[wait.XRequestIDHeader][0]

// Wait for attachment of the nic
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, requestId).WaitWithContext(context.Background())
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, region, requestId).WaitWithContext(context.Background())
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when waiting for attachment: %v\n", err)
os.Exit(1)
}

fmt.Printf("[iaas API] Nic %q has been successfully attached to the server %s.\n", nicId, serverId)

err = iaasClient.RemoveNicFromServer(ctxWithHTTPResp, projectId, serverId, nicId).Execute()
err = iaasClient.RemoveNicFromServer(ctxWithHTTPResp, projectId, region, serverId, nicId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when calling `RemoveNICFromServer`: %v\n", err)
} else {
Expand All @@ -57,7 +55,7 @@ func main() {
requestId = httpResp.Header[wait.XRequestIDHeader][0]

// Wait for dettachment of the nic
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, requestId).WaitWithContext(context.Background())
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, region, requestId).WaitWithContext(context.Background())
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when waiting for removal of attachment of NIC: %v\n", err)
os.Exit(1)
Expand Down
16 changes: 7 additions & 9 deletions examples/iaas/attach_public_ip/attach_public_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,20 @@ import (
"net/http"
"os"

"github.com/stackitcloud/stackit-sdk-go/core/config"
"github.com/stackitcloud/stackit-sdk-go/core/runtime"
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
)

func main() {
// Specify the organization ID and project ID
// Specify the project ID, server ID, public ip ID and region
projectId := "PROJECT_ID" // the uuid of your STACKIT project
serverId := "SERVER_ID"
publicIpId := "PUBLIC_IP_ID"
region := "eu01"

// Create a new API client, that uses default authentication and configuration
iaasClient, err := iaas.NewAPIClient(
config.WithRegion("eu01"),
)
iaasClient, err := iaas.NewAPIClient()
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Creating API client: %v\n", err)
os.Exit(1)
Expand All @@ -30,7 +28,7 @@ func main() {
// Attach an existing network interface to an existing server
var httpResp *http.Response
ctxWithHTTPResp := runtime.WithCaptureHTTPResponse(context.Background(), &httpResp)
err = iaasClient.AddPublicIpToServer(ctxWithHTTPResp, projectId, serverId, publicIpId).Execute()
err = iaasClient.AddPublicIpToServer(ctxWithHTTPResp, projectId, region, serverId, publicIpId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when calling `AddPublicIpToServer`: %v\n", err)
} else {
Expand All @@ -39,15 +37,15 @@ func main() {
requestId := httpResp.Header[wait.XRequestIDHeader][0]

// Wait for attachment of the public ip
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, requestId).WaitWithContext(context.Background())
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, region, requestId).WaitWithContext(context.Background())
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when waiting for attachment: %v\n", err)
os.Exit(1)
}

fmt.Printf("[iaas API] Public IP %q has been successfully attached to the server %s.\n", publicIpId, serverId)

err = iaasClient.RemovePublicIpFromServer(ctxWithHTTPResp, projectId, serverId, publicIpId).Execute()
err = iaasClient.RemovePublicIpFromServer(ctxWithHTTPResp, projectId, region, serverId, publicIpId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when calling `RemovePublicIpFromServer`: %v\n", err)
} else {
Expand All @@ -57,7 +55,7 @@ func main() {
requestId = httpResp.Header[wait.XRequestIDHeader][0]

// Wait for dettachment of the public ip
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, requestId).WaitWithContext(context.Background())
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, region, requestId).WaitWithContext(context.Background())
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when waiting for removal of attachment of PublicIp: %v\n", err)
os.Exit(1)
Expand Down
16 changes: 7 additions & 9 deletions examples/iaas/attach_security_group/attach_security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,20 @@ import (
"net/http"
"os"

"github.com/stackitcloud/stackit-sdk-go/core/config"
"github.com/stackitcloud/stackit-sdk-go/core/runtime"
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
)

func main() {
// Specify the organization ID and project ID
// Specify the project ID, server ID, security group ID and region
projectId := "PROJECT_ID" // the uuid of your STACKIT project
serverId := "SERVER_ID"
securityGroupId := "SECURITY_GROUP_ID"
region := "eu01"

// Create a new API client, that uses default authentication and configuration
iaasClient, err := iaas.NewAPIClient(
config.WithRegion("eu01"),
)
iaasClient, err := iaas.NewAPIClient()
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Creating API client: %v\n", err)
os.Exit(1)
Expand All @@ -30,7 +28,7 @@ func main() {
// Attach an existing network interface to an existing server
var httpResp *http.Response
ctxWithHTTPResp := runtime.WithCaptureHTTPResponse(context.Background(), &httpResp)
err = iaasClient.AddSecurityGroupToServer(ctxWithHTTPResp, projectId, serverId, securityGroupId).Execute()
err = iaasClient.AddSecurityGroupToServer(ctxWithHTTPResp, projectId, region, serverId, securityGroupId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when calling `AddSecurityGroupToServer`: %v\n", err)
} else {
Expand All @@ -39,15 +37,15 @@ func main() {
requestId := httpResp.Header[wait.XRequestIDHeader][0]

// Wait for attachment of the security group
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, requestId).WaitWithContext(context.Background())
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, region, requestId).WaitWithContext(context.Background())
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when waiting for attachment: %v\n", err)
os.Exit(1)
}

fmt.Printf("[iaas API] Security group %q has been successfully attached to the server %s.\n", securityGroupId, serverId)

err = iaasClient.RemoveSecurityGroupFromServer(ctxWithHTTPResp, projectId, serverId, securityGroupId).Execute()
err = iaasClient.RemoveSecurityGroupFromServer(ctxWithHTTPResp, projectId, region, serverId, securityGroupId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when calling `RemoveSecurityGroupFromServer`: %v\n", err)
} else {
Expand All @@ -57,7 +55,7 @@ func main() {
requestId = httpResp.Header[wait.XRequestIDHeader][0]

// Wait for dettachment of the security group
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, requestId).WaitWithContext(context.Background())
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, region, requestId).WaitWithContext(context.Background())
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when waiting for removal of attachment of SecurityGroup: %v\n", err)
os.Exit(1)
Expand Down
16 changes: 7 additions & 9 deletions examples/iaas/attach_service_account/attach_service_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,20 @@ import (
"net/http"
"os"

"github.com/stackitcloud/stackit-sdk-go/core/config"
"github.com/stackitcloud/stackit-sdk-go/core/runtime"
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
)

func main() {
// Specify the organization ID and project ID
// Specify the project ID, server ID, service account mail and region
projectId := "PROJECT_ID" // the uuid of your STACKIT project
serverId := "SERVER_ID"
serviceAccountMail := "SERVICE_ACCOUNT_MAIL"
region := "eu01"

// Create a new API client, that uses default authentication and configuration
iaasClient, err := iaas.NewAPIClient(
config.WithRegion("eu01"),
)
iaasClient, err := iaas.NewAPIClient()
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Creating API client: %v\n", err)
os.Exit(1)
Expand All @@ -30,7 +28,7 @@ func main() {
// Attach an existing service account to an existing server
var httpResp *http.Response
ctxWithHTTPResp := runtime.WithCaptureHTTPResponse(context.Background(), &httpResp)
_, err = iaasClient.AddServiceAccountToServer(ctxWithHTTPResp, projectId, serverId, serviceAccountMail).Execute()
_, err = iaasClient.AddServiceAccountToServer(ctxWithHTTPResp, projectId, region, serverId, serviceAccountMail).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when calling `AddServiceAccountToServer`: %v\n", err)
} else {
Expand All @@ -39,15 +37,15 @@ func main() {
requestId := httpResp.Header[wait.XRequestIDHeader][0]

// Wait for attachment of the service account
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, requestId).WaitWithContext(context.Background())
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, region, requestId).WaitWithContext(context.Background())
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when waiting for attachment: %v\n", err)
os.Exit(1)
}

fmt.Printf("[iaas API] Service account %q has been successfully attached to the server %s.\n", serviceAccountMail, serverId)

_, err = iaasClient.RemoveServiceAccountFromServer(ctxWithHTTPResp, projectId, serverId, serviceAccountMail).Execute()
_, err = iaasClient.RemoveServiceAccountFromServer(ctxWithHTTPResp, projectId, region, serverId, serviceAccountMail).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when calling `RemoveServiceAccountFromServer`: %v\n", err)
} else {
Expand All @@ -57,7 +55,7 @@ func main() {
requestId = httpResp.Header[wait.XRequestIDHeader][0]

// Wait for dettachment of the service account
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, requestId).WaitWithContext(context.Background())
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, region, requestId).WaitWithContext(context.Background())
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when waiting for removal of attachment of service account: %v\n", err)
os.Exit(1)
Expand Down
16 changes: 7 additions & 9 deletions examples/iaas/attach_volume/attach_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,50 @@ import (
"fmt"
"os"

"github.com/stackitcloud/stackit-sdk-go/core/config"
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
)

func main() {
// Specify the organization ID and project ID
// Specify the project ID, server ID, volume ID and region
projectId := "PROJECT_ID" // the uuid of your STACKIT project
serverId := "SERVER_ID"
volumeId := "VOLUME_ID"
region := "eu01"

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

payload := iaas.AddVolumeToServerPayload{}
_, err = iaasClient.AddVolumeToServer(context.Background(), projectId, serverId, volumeId).AddVolumeToServerPayload(payload).Execute()
_, err = iaasClient.AddVolumeToServer(context.Background(), projectId, region, serverId, volumeId).AddVolumeToServerPayload(payload).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when calling `AddVolumeToServer`: %v\n", err)
} else {
fmt.Printf("[iaas API] Triggered attachment of volume with ID %q.\n", volumeId)
}

// Wait for attachment of the volume
_, err = wait.AddVolumeToServerWaitHandler(context.Background(), iaasClient, projectId, serverId, volumeId).WaitWithContext(context.Background())
_, err = wait.AddVolumeToServerWaitHandler(context.Background(), iaasClient, projectId, region, serverId, volumeId).WaitWithContext(context.Background())
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when waiting for attachment: %v\n", err)
os.Exit(1)
}

fmt.Printf("[iaas API] Volume %q has been successfully attached to the server %s.\n", volumeId, serverId)

err = iaasClient.RemoveVolumeFromServer(context.Background(), projectId, serverId, volumeId).Execute()
err = iaasClient.RemoveVolumeFromServer(context.Background(), projectId, region, serverId, volumeId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when calling `RemoveVolumeFromServer`: %v\n", err)
} else {
fmt.Printf("[iaas API] Triggered removal of attachment of volume with ID %q.\n", volumeId)
}

// Wait for dettachment of the volume
_, err = wait.RemoveVolumeFromServerWaitHandler(context.Background(), iaasClient, projectId, serverId, volumeId).WaitWithContext(context.Background())
_, err = wait.RemoveVolumeFromServerWaitHandler(context.Background(), iaasClient, projectId, region, serverId, volumeId).WaitWithContext(context.Background())
if err != nil {
fmt.Fprintf(os.Stderr, "[iaas API] Error when waiting for removal of attachment of volume: %v\n", err)
os.Exit(1)
Expand Down
Loading
Loading