Skip to content

Commit 1eb057b

Browse files
Generator: Update SDK /services/iaas (#3662)
* Generate iaas - region adjustment and api v2 migration --------- Co-authored-by: Marcel Jacek <Marcel.Jacek@stackit.cloud>
1 parent d557447 commit 1eb057b

File tree

334 files changed

+17464
-5436
lines changed

Some content is hidden

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

334 files changed

+17464
-5436
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@
44
- `postgresflex`: [v1.3.0](services/postgresflex/CHANGELOG.md#v130)
55
- **Breaking Change:** The attribute type for `PartialUpdateInstancePayload` and `UpdateInstancePayload` changed from `Storage` to `StorageUpdate`.
66
- **Deprecation:** `StorageUpdate`: updating the performance class field is not possible.
7+
- `iaas`: [v1.0.0](services/iaas/CHANGELOG.md#v100)
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.
9+
- **Feature:** Add new methods to manage routing tables: `AddRoutingTableToArea`, `DeleteRoutingTableFromArea`, `GetRoutingTableOfArea`, `ListRoutingTablesOfArea`, `UpdateRoutingTableOfArea`
10+
- **Feature:** Add new methods to manage routes in routing tables: `AddRoutesToRoutingTable`, `DeleteRouteFromRoutingTable`, `GetRouteOfRoutingTable`, `ListRoutesOfRoutingTable`, `UpdateRouteOfRoutingTable`
11+
- **Breaking Change:** Add new method to manage network area regions: `CreateNetworkAreaRegion`, `DeleteNetworkAreaRegion`, `GetNetworkAreaRegion`, `ListNetworkAreaRegions`, `UpdateNetworkAreaRegion`
12+
- **Feature:** Add new wait handler for network area region: `CreateNetworkAreaRegionWaitHandler` and `DeleteRegionalNetworkAreaConfigurationWaitHandler`
13+
- **Breaking Change:** Wait handler which relates to region-specific services, got an additional param for the region: `CreateNetworkWaitHandler`, `UpdateNetworkWaitHandler`, `DeleteNetworkWaitHandler`, `CreateVolumeWaitHandler`, `DeleteVolumeWaitHandler`, `CreateServerWaitHandler`, `ResizeServerWaitHandler`, `DeleteServerWaitHandler`, `StartServerWaitHandler`, `StopServerWaitHandler`, `DeallocateServerWaitHandler`, `RescueServerWaitHandler`, `UnrescueServerWaitHandler`, `ProjectRequestWaitHandler`, `AddVolumeToServerWaitHandler`, `RemoveVolumeFromServerWaitHandler`, `UploadImageWaitHandler`, `DeleteImageWaitHandler`, `CreateBackupWaitHandler`, `DeleteBackupWaitHandler`, `RestoreBackupWaitHandler`, `CreateSnapshotWaitHandler`, `DeleteSnapshotWaitHandler`
14+
- **Breaking Change:** `Network` model has changed:
15+
- `NetworkId` has been renamed to `Id`
16+
- `Gateway`, `Nameservers`, `Prefixes` and `PublicIp` has been moved to new model `NetworkIPv4`, and can be accessed in the new property `IPv4`
17+
- Properties `Gatewayv6`, `Nameserversv6` and `Prefixesv6` moved to new model `NetworkIPv6`, and can be accessed in the new property `IPv6`
18+
- **Breaking Change:** `CreateServerPayload` model has changed:
19+
- Model `CreateServerPayloadBootVolume` of `BootVolume` property changed to `ServerBootVolume`
20+
- Property `Networking` in `CreateServerPayload` is required now
21+
- **Deprecated:** Deprecated wait handler and will be removed after April 2026: `CreateNetworkAreaWaitHandler`, `UpdateNetworkAreaWaitHandler` and `DeleteNetworkAreaWaitHandler`
722

823
## Release (2025-10-13)
924
- `observability`: [v0.15.0](services/observability/CHANGELOG.md#v0150)

examples/iaas/attach_nic/attach_nic.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,20 @@ 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/iaas"
1211
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
1312
)
1413

1514
func main() {
16-
// Specify the organization ID and project ID
15+
// Specify the project ID, server ID, nic ID and region
1716
projectId := "PROJECT_ID" // the uuid of your STACKIT project
1817
serverId := "SERVER_ID"
1918
nicId := "NIC_ID"
19+
region := "eu01"
2020

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

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

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

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

5957
// Wait for dettachment of the nic
60-
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, requestId).WaitWithContext(context.Background())
58+
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, region, requestId).WaitWithContext(context.Background())
6159
if err != nil {
6260
fmt.Fprintf(os.Stderr, "[iaas API] Error when waiting for removal of attachment of NIC: %v\n", err)
6361
os.Exit(1)

examples/iaas/attach_public_ip/attach_public_ip.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,20 @@ 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/iaas"
1211
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
1312
)
1413

1514
func main() {
16-
// Specify the organization ID and project ID
15+
// Specify the project ID, server ID, public ip ID and region
1716
projectId := "PROJECT_ID" // the uuid of your STACKIT project
1817
serverId := "SERVER_ID"
1918
publicIpId := "PUBLIC_IP_ID"
19+
region := "eu01"
2020

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

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

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

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

5957
// Wait for dettachment of the public ip
60-
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, requestId).WaitWithContext(context.Background())
58+
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, region, requestId).WaitWithContext(context.Background())
6159
if err != nil {
6260
fmt.Fprintf(os.Stderr, "[iaas API] Error when waiting for removal of attachment of PublicIp: %v\n", err)
6361
os.Exit(1)

examples/iaas/attach_security_group/attach_security_group.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,20 @@ 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/iaas"
1211
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
1312
)
1413

1514
func main() {
16-
// Specify the organization ID and project ID
15+
// Specify the project ID, server ID, security group ID and region
1716
projectId := "PROJECT_ID" // the uuid of your STACKIT project
1817
serverId := "SERVER_ID"
1918
securityGroupId := "SECURITY_GROUP_ID"
19+
region := "eu01"
2020

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

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

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

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

5957
// Wait for dettachment of the security group
60-
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, requestId).WaitWithContext(context.Background())
58+
_, err = wait.ProjectRequestWaitHandler(context.Background(), iaasClient, projectId, region, requestId).WaitWithContext(context.Background())
6159
if err != nil {
6260
fmt.Fprintf(os.Stderr, "[iaas API] Error when waiting for removal of attachment of SecurityGroup: %v\n", err)
6361
os.Exit(1)

examples/iaas/attach_service_account/attach_service_account.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,20 @@ 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/iaas"
1211
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
1312
)
1413

1514
func main() {
16-
// Specify the organization ID and project ID
15+
// Specify the project ID, server ID, service account mail and region
1716
projectId := "PROJECT_ID" // the uuid of your STACKIT project
1817
serverId := "SERVER_ID"
1918
serviceAccountMail := "SERVICE_ACCOUNT_MAIL"
19+
region := "eu01"
2020

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

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

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

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

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

examples/iaas/attach_volume/attach_volume.go

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

8-
"github.com/stackitcloud/stackit-sdk-go/core/config"
98
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
109
"github.com/stackitcloud/stackit-sdk-go/services/iaas/wait"
1110
)
1211

1312
func main() {
14-
// Specify the organization ID and project ID
13+
// Specify the project ID, server ID, volume ID and region
1514
projectId := "PROJECT_ID" // the uuid of your STACKIT project
1615
serverId := "SERVER_ID"
1716
volumeId := "VOLUME_ID"
17+
region := "eu01"
1818

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

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

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

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

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

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

0 commit comments

Comments
 (0)