Skip to content

Commit abedae9

Browse files
feat(sfs): add multi API version support (#5744)
relates to STACKITSDK-359 Co-authored-by: Ruben Hoenle <Ruben.Hoenle@stackit.cloud>
1 parent dc19faf commit abedae9

File tree

157 files changed

+30939
-78
lines changed

Some content is hidden

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

157 files changed

+30939
-78
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@
158158
- `v1api`: New package which should be used for communication with the STACKIT secretsmanager API in the future
159159
- **Deprecation:** The contents in the root of this SDK module including the `wait` package are marked as deprecated and will be removed after 2026-09-30. Switch to the new `v1api` package instead.
160160
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
161+
- `sfs`: [v0.5.0](services/sfs/CHANGELOG.md#v050)
162+
- **Feature:** Introduction of multi API version support for the sfs SDK module. For more details please see the announcement on GitHub: https://github.com/stackitcloud/stackit-sdk-go/discussions/5062
163+
- `v1api`: New package which can be used for communication with the SFS v1 API
164+
- `v1betaapi`: New package which can be used for communication with the SFS v1 beta API
165+
- **Deprecation:** The contents in the root of this SDK module including the `wait` package are marked as deprecated and will be removed after 2026-09-30. Switch to the new packages for the available API versions instead.
166+
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
161167

162168
## Release (2026-02-20)
163169
- `core`: [v0.21.1](core/CHANGELOG.md#v0211)

examples/sfs/go.mod

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

33
go 1.21
44

5+
// This is not needed in production. This is only here to point the golangci linter to the local version instead of the last release on GitHub.
6+
replace github.com/stackitcloud/stackit-sdk-go/services/sfs => ../../services/sfs
7+
58
require (
6-
github.com/stackitcloud/stackit-sdk-go/core v0.21.1
9+
github.com/stackitcloud/stackit-sdk-go/core v0.22.0
710
github.com/stackitcloud/stackit-sdk-go/services/sfs v0.4.0
811
)
912

examples/sfs/go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
44
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
55
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
66
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
7-
github.com/stackitcloud/stackit-sdk-go/core v0.21.1 h1:Y/PcAgM7DPYMNqum0MLv4n1mF9ieuevzcCIZYQfm3Ts=
8-
github.com/stackitcloud/stackit-sdk-go/core v0.21.1/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI=
9-
github.com/stackitcloud/stackit-sdk-go/services/sfs v0.4.0 h1:ofdGO2dGH6ywKbIVxaxRVal3jWX9WlcHSm5BTud5bC4=
10-
github.com/stackitcloud/stackit-sdk-go/services/sfs v0.4.0/go.mod h1:r5lBwzJpJe2xBIYctkVIIpaZ41Y6vUEpkmsWR2VoQJs=
7+
github.com/stackitcloud/stackit-sdk-go/core v0.22.0 h1:6rViz7GnNwXSh51Lur5xuDzO8EWSZfN9J0HvEkBKq6c=
8+
github.com/stackitcloud/stackit-sdk-go/core v0.22.0/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI=

examples/sfs/resourcepool/resourcepool.go

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"os"
77

88
"github.com/stackitcloud/stackit-sdk-go/core/utils"
9-
"github.com/stackitcloud/stackit-sdk-go/services/sfs"
10-
"github.com/stackitcloud/stackit-sdk-go/services/sfs/wait"
9+
sfs "github.com/stackitcloud/stackit-sdk-go/services/sfs/v1api"
10+
"github.com/stackitcloud/stackit-sdk-go/services/sfs/v1api/wait"
1111
)
1212

1313
func main() {
@@ -24,14 +24,17 @@ func main() {
2424

2525
// Create a resource pool
2626
createResourcePoolPayload := sfs.CreateResourcePoolPayload{
27-
AvailabilityZone: utils.Ptr("eu01-m"),
28-
Name: utils.Ptr("example-resourcepool-test"),
29-
PerformanceClass: utils.Ptr("Standard"),
30-
IpAcl: &[]string{"192.168.42.1/32", "192.168.42.2/32"},
31-
SizeGigabytes: utils.Ptr(int64(512)),
27+
AvailabilityZone: "eu01-m",
28+
Name: "example-resourcepool-test",
29+
PerformanceClass: "Standard",
30+
IpAcl: []string{
31+
"192.168.42.1/32",
32+
"192.168.42.2/32",
33+
},
34+
SizeGigabytes: int32(512),
3235
}
3336

34-
resourcePool, err := sfsClient.CreateResourcePool(context.Background(), projectId, region).CreateResourcePoolPayload(createResourcePoolPayload).Execute()
37+
resourcePool, err := sfsClient.DefaultAPI.CreateResourcePool(context.Background(), projectId, region).CreateResourcePoolPayload(createResourcePoolPayload).Execute()
3538
if err != nil {
3639
fmt.Fprintf(os.Stderr, "[sfs API] Error when calling `CreateResourcePool`: %v\n", err)
3740
os.Exit(1)
@@ -45,7 +48,7 @@ func main() {
4548
fmt.Printf("[sfs API] Current state of the resource pool: %q\n", *resourcePool.ResourcePool.State)
4649
fmt.Println("[sfs API] Waiting for resource pool to be created...")
4750

48-
resourcePoolResp, err := wait.CreateResourcePoolWaitHandler(context.Background(), sfsClient, projectId, region, *resourcePool.ResourcePool.Id).WaitWithContext(context.Background())
51+
resourcePoolResp, err := wait.CreateResourcePoolWaitHandler(context.Background(), sfsClient.DefaultAPI, projectId, region, *resourcePool.ResourcePool.Id).WaitWithContext(context.Background())
4952
if err != nil {
5053
fmt.Fprintf(os.Stderr, "[sfs API] Error when waiting for creation: %v\n", err)
5154
os.Exit(1)
@@ -54,7 +57,7 @@ func main() {
5457
fmt.Printf("[sfs API] Resource pool has been successfully created.\n")
5558

5659
// Describe the resource pool
57-
getResourcePoolResp, err := sfsClient.GetResourcePool(context.Background(), projectId, region, *resourcePoolResp.ResourcePool.Id).Execute()
60+
getResourcePoolResp, err := sfsClient.DefaultAPI.GetResourcePool(context.Background(), projectId, region, *resourcePoolResp.ResourcePool.Id).Execute()
5861
if err != nil {
5962
fmt.Fprintf(os.Stderr, "[sfs API] Error when calling `GetResoucePool`: %v\n", err)
6063
os.Exit(1)
@@ -64,16 +67,16 @@ func main() {
6467

6568
// Update the resource pool
6669
updateResourcePoolPayload := sfs.UpdateResourcePoolPayload{
67-
SizeGigabytes: utils.Ptr(int64(600)),
70+
SizeGigabytes: *sfs.NewNullableInt32(utils.Ptr(int32(600))),
6871
}
6972

70-
updateResourcePool, err := sfsClient.UpdateResourcePool(context.Background(), projectId, region, *resourcePoolResp.ResourcePool.Id).UpdateResourcePoolPayload(updateResourcePoolPayload).Execute()
73+
updateResourcePool, err := sfsClient.DefaultAPI.UpdateResourcePool(context.Background(), projectId, region, *resourcePoolResp.ResourcePool.Id).UpdateResourcePoolPayload(updateResourcePoolPayload).Execute()
7174
if err != nil {
7275
fmt.Fprintf(os.Stderr, "[sfs API] Error when calling `UpdateResourcePool`: %v\n", err)
7376
os.Exit(1)
7477
}
7578

76-
_, err = wait.UpdateResourcePoolWaitHandler(context.Background(), sfsClient, projectId, region, *resourcePoolResp.ResourcePool.Id).WaitWithContext(context.Background())
79+
_, err = wait.UpdateResourcePoolWaitHandler(context.Background(), sfsClient.DefaultAPI, projectId, region, *resourcePoolResp.ResourcePool.Id).WaitWithContext(context.Background())
7780
if err != nil {
7881
fmt.Fprintf(os.Stderr, "[sfs API] Error when waiting for update: %v\n", err)
7982
os.Exit(1)
@@ -82,13 +85,13 @@ func main() {
8285
fmt.Printf("[sfs API] Resource pool has been successfully updated to new size %d.\n", *updateResourcePool.ResourcePool.Space.SizeGigabytes)
8386

8487
// Delete the resource pool
85-
_, err = sfsClient.DeleteResourcePool(context.Background(), projectId, region, *resourcePoolResp.ResourcePool.Id).Execute()
88+
_, err = sfsClient.DefaultAPI.DeleteResourcePool(context.Background(), projectId, region, *resourcePoolResp.ResourcePool.Id).Execute()
8689
if err != nil {
8790
fmt.Fprintf(os.Stderr, "[sfs API] Error when calling `DeleteResourcePool`: %v\n", err)
8891
os.Exit(1)
8992
}
9093

91-
_, err = wait.DeleteResourcePoolWaitHandler(context.Background(), sfsClient, projectId, region, *resourcePoolResp.ResourcePool.Id).WaitWithContext(context.Background())
94+
_, err = wait.DeleteResourcePoolWaitHandler(context.Background(), sfsClient.DefaultAPI, projectId, region, *resourcePoolResp.ResourcePool.Id).WaitWithContext(context.Background())
9295
if err != nil {
9396
fmt.Fprintf(os.Stderr, "[sfs API] Error when waiting for deletion: %v\n", err)
9497
os.Exit(1)

examples/sfs/share/share.go

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"os"
77

88
"github.com/stackitcloud/stackit-sdk-go/core/utils"
9-
"github.com/stackitcloud/stackit-sdk-go/services/sfs"
10-
"github.com/stackitcloud/stackit-sdk-go/services/sfs/wait"
9+
sfs "github.com/stackitcloud/stackit-sdk-go/services/sfs/v1api"
10+
"github.com/stackitcloud/stackit-sdk-go/services/sfs/v1api/wait"
1111
)
1212

1313
func main() {
@@ -24,14 +24,17 @@ func main() {
2424

2525
// Create a resource pool in order to create a share
2626
createResourcePoolPayload := sfs.CreateResourcePoolPayload{
27-
AvailabilityZone: utils.Ptr("eu01-m"),
28-
Name: utils.Ptr("example-resourcepool-share-test"),
29-
PerformanceClass: utils.Ptr("Standard"),
30-
IpAcl: &[]string{"192.168.42.1/32", "192.168.42.2/32"},
31-
SizeGigabytes: utils.Ptr(int64(512)),
27+
AvailabilityZone: "eu01-m",
28+
Name: "example-resourcepool-share-test",
29+
PerformanceClass: "Standard",
30+
IpAcl: []string{
31+
"192.168.42.1/32",
32+
"192.168.42.2/32",
33+
},
34+
SizeGigabytes: int32(512),
3235
}
3336

34-
resourcePool, err := sfsClient.CreateResourcePool(context.Background(), projectId, region).CreateResourcePoolPayload(createResourcePoolPayload).Execute()
37+
resourcePool, err := sfsClient.DefaultAPI.CreateResourcePool(context.Background(), projectId, region).CreateResourcePoolPayload(createResourcePoolPayload).Execute()
3538
if err != nil {
3639
fmt.Fprintf(os.Stderr, "[sfs API] Error when calling `CreateResourcePool`: %v\n", err)
3740
os.Exit(1)
@@ -45,7 +48,7 @@ func main() {
4548
fmt.Printf("[sfs API] Current state of the resource pool: %q\n", *resourcePool.ResourcePool.State)
4649
fmt.Println("[sfs API] Waiting for resource pool to be created...")
4750

48-
_, err = wait.CreateResourcePoolWaitHandler(context.Background(), sfsClient, projectId, region, *resourcePool.ResourcePool.Id).WaitWithContext(context.Background())
51+
_, err = wait.CreateResourcePoolWaitHandler(context.Background(), sfsClient.DefaultAPI, projectId, region, *resourcePool.ResourcePool.Id).WaitWithContext(context.Background())
4952
if err != nil {
5053
fmt.Fprintf(os.Stderr, "[sfs API] Error when waiting for creation of resource pool: %v\n", err)
5154
os.Exit(1)
@@ -55,11 +58,11 @@ func main() {
5558

5659
// Create a share for the resource pool
5760
createSharePayload := sfs.CreateSharePayload{
58-
Name: utils.Ptr("example-share-name"),
59-
SpaceHardLimitGigabytes: utils.Ptr(int64(100)),
61+
Name: "example-share-name",
62+
SpaceHardLimitGigabytes: int32(100),
6063
}
6164

62-
share, err := sfsClient.CreateShare(context.Background(), projectId, region, *resourcePool.ResourcePool.Id).CreateSharePayload(createSharePayload).Execute()
65+
share, err := sfsClient.DefaultAPI.CreateShare(context.Background(), projectId, region, *resourcePool.ResourcePool.Id).CreateSharePayload(createSharePayload).Execute()
6366
if err != nil {
6467
fmt.Fprintf(os.Stderr, "[sfs API] Error when waiting calling `CreateShare`: %v\n", err)
6568
os.Exit(1)
@@ -69,7 +72,7 @@ func main() {
6972
fmt.Fprintf(os.Stderr, "[sfs API] Error creating share. Calling API: Incomplete response")
7073
}
7174

72-
_, err = wait.CreateShareWaitHandler(context.Background(), sfsClient, projectId, region, *resourcePool.ResourcePool.Id, *share.Share.Id).WaitWithContext(context.Background())
75+
_, err = wait.CreateShareWaitHandler(context.Background(), sfsClient.DefaultAPI, projectId, region, *resourcePool.ResourcePool.Id, *share.Share.Id).WaitWithContext(context.Background())
7376
if err != nil {
7477
fmt.Fprintf(os.Stderr, "[sfs API] Error when waiting for creation: %v\n", err)
7578
os.Exit(1)
@@ -78,7 +81,7 @@ func main() {
7881
fmt.Printf("[sfs API] Share has been successfully created.\n")
7982

8083
// Describe the share
81-
getShareResp, err := sfsClient.GetShare(context.Background(), projectId, region, *resourcePool.ResourcePool.Id, *share.Share.Id).Execute()
84+
getShareResp, err := sfsClient.DefaultAPI.GetShare(context.Background(), projectId, region, *resourcePool.ResourcePool.Id, *share.Share.Id).Execute()
8285
if err != nil {
8386
fmt.Fprintf(os.Stderr, "[sfs API] Error when calling `GetShare`: %v\n", err)
8487
os.Exit(1)
@@ -88,16 +91,16 @@ func main() {
8891

8992
// Update the share
9093
updateSharePayload := sfs.UpdateSharePayload{
91-
SpaceHardLimitGigabytes: utils.Ptr(int64(150)),
94+
SpaceHardLimitGigabytes: *sfs.NewNullableInt32(utils.Ptr(int32(150))),
9295
}
9396

94-
updateShare, err := sfsClient.UpdateShare(context.Background(), projectId, region, *resourcePool.ResourcePool.Id, *share.Share.Id).UpdateSharePayload(updateSharePayload).Execute()
97+
updateShare, err := sfsClient.DefaultAPI.UpdateShare(context.Background(), projectId, region, *resourcePool.ResourcePool.Id, *share.Share.Id).UpdateSharePayload(updateSharePayload).Execute()
9598
if err != nil {
9699
fmt.Fprintf(os.Stderr, "[sfs API] Error when calling `UpdateShare`: %v\n", err)
97100
os.Exit(1)
98101
}
99102

100-
_, err = wait.UpdateShareWaitHandler(context.Background(), sfsClient, projectId, region, *resourcePool.ResourcePool.Id, *share.Share.Id).WaitWithContext(context.Background())
103+
_, err = wait.UpdateShareWaitHandler(context.Background(), sfsClient.DefaultAPI, projectId, region, *resourcePool.ResourcePool.Id, *share.Share.Id).WaitWithContext(context.Background())
101104
if err != nil {
102105
fmt.Fprintf(os.Stderr, "[sfs API] Error when waiting for update: %v\n", err)
103106
os.Exit(1)
@@ -106,13 +109,13 @@ func main() {
106109
fmt.Printf("[sfs API] Share has been successfully updated to new limit %d.\n", *updateShare.Share.SpaceHardLimitGigabytes)
107110

108111
// Delete share
109-
_, err = sfsClient.DeleteShare(context.Background(), projectId, region, *resourcePool.ResourcePool.Id, *share.Share.Id).Execute()
112+
_, err = sfsClient.DefaultAPI.DeleteShare(context.Background(), projectId, region, *resourcePool.ResourcePool.Id, *share.Share.Id).Execute()
110113
if err != nil {
111114
fmt.Fprintf(os.Stderr, "[sfs API] Error when calling `DeleteShare`: %v\n", err)
112115
os.Exit(1)
113116
}
114117

115-
_, err = wait.DeleteShareWaitHandler(context.Background(), sfsClient, projectId, region, *resourcePool.ResourcePool.Id, *share.Share.Id).WaitWithContext(context.Background())
118+
_, err = wait.DeleteShareWaitHandler(context.Background(), sfsClient.DefaultAPI, projectId, region, *resourcePool.ResourcePool.Id, *share.Share.Id).WaitWithContext(context.Background())
116119
if err != nil {
117120
fmt.Fprintf(os.Stderr, "[sfs API] Error when waiting for deletion: %v\n", err)
118121
os.Exit(1)
@@ -121,13 +124,13 @@ func main() {
121124
fmt.Printf("[sfs API] Share has been successfully deleted.\n")
122125

123126
// Delete resource pool
124-
_, err = sfsClient.DeleteResourcePool(context.Background(), projectId, region, *resourcePool.ResourcePool.Id).Execute()
127+
_, err = sfsClient.DefaultAPI.DeleteResourcePool(context.Background(), projectId, region, *resourcePool.ResourcePool.Id).Execute()
125128
if err != nil {
126129
fmt.Fprintf(os.Stderr, "[sfs API] Error when calling `DeleteResourcePool`: %v\n", err)
127130
os.Exit(1)
128131
}
129132

130-
_, err = wait.DeleteResourcePoolWaitHandler(context.Background(), sfsClient, projectId, region, *resourcePool.ResourcePool.Id).WaitWithContext(context.Background())
133+
_, err = wait.DeleteResourcePoolWaitHandler(context.Background(), sfsClient.DefaultAPI, projectId, region, *resourcePool.ResourcePool.Id).WaitWithContext(context.Background())
131134
if err != nil {
132135
fmt.Fprintf(os.Stderr, "[sfs API] Error when waiting for deletion: %v\n", err)
133136
os.Exit(1)

services/sfs/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## v0.5.0
2+
- **Feature:** Introduction of multi API version support for the sfs SDK module. For more details please see the announcement on GitHub: https://github.com/stackitcloud/stackit-sdk-go/discussions/5062
3+
- `v1api`: New package which can be used for communication with the SFS v1 API
4+
- `v1betaapi`: New package which can be used for communication with the SFS v1 beta API
5+
- **Deprecation:** The contents in the root of this SDK module including the `wait` package are marked as deprecated and will be removed after 2026-09-30. Switch to the new packages for the available API versions instead.
6+
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
7+
18
## v0.4.0
29
- **Breaking change:** The `name` and `spaceHardLimitGigabytes` fields are now marked as required for `ShareExportPayload`, `SharePayload`.
310

services/sfs/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.4.0
1+
v0.5.0

0 commit comments

Comments
 (0)