Skip to content

Commit e8465e8

Browse files
feat(loadbalancer): add multi API version support (#5508)
relates to STACKITSDK-339 Co-authored-by: Ruben Hoenle <Ruben.Hoenle@stackit.cloud>
1 parent b3fad00 commit e8465e8

File tree

134 files changed

+25204
-84
lines changed

Some content is hidden

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

134 files changed

+25204
-84
lines changed

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,15 @@
66
- **Feature:** Add new field `AltPort` to `ActiveHealthCheck`
77
- **Feature:** Add new field `Tls` to `HttpHealthCheck`
88
- **Breaking change:** Renamed `TargetPoolTlsConfig` to `TlsConfig`
9-
- `loadbalancer`: [v1.8.0](services/loadbalancer/CHANGELOG.md#v180)
10-
- **Feature:** Add new fields `AltPort` and `HttpHealthCheck` to `ActiveHealthCheck`
9+
- `loadbalancer`:
10+
- [v1.8.0](services/loadbalancer/CHANGELOG.md#v180)
11+
- **Feature:** Add new fields `AltPort` and `HttpHealthCheck` to `ActiveHealthCheck`
12+
- [v1.9.0](services/loadbalancer/CHANGELOG.md#v190)
13+
- **Feature:** Introduction of multi API version support for the loadbalancer SDK module. For more details please see the announcement on GitHub: https://github.com/stackitcloud/stackit-sdk-go/discussions/5062
14+
- `v1api`: New package which can be used for communication with the loadbalancer v1 API
15+
- `v2api`: New package which can be used for communication with the loadbalancer v2 API
16+
- **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.
17+
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
1118
- `resourcemanager`: [v0.19.0](services/resourcemanager/CHANGELOG.md#v0190)
1219
- **Feature:** Introduction of multi API version support for the resourcemanager SDK module. For more details please see the announcement on GitHub: https://github.com/stackitcloud/stackit-sdk-go/discussions/5062
1320
- `v0api`: New package which should be used for communication with the STACKIT Resourcemanager API in the future

examples/loadbalancer/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/loadbalancer
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/loadbalancer => ../../services/loadbalancer
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/loadbalancer v1.7.3
811
)
912

examples/loadbalancer/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/loadbalancer v1.7.3 h1:d/qIj+XNaqByVbLvwpWoA0Ekv0yrONWyNswg4/jGX7Y=
10-
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.7.3/go.mod h1:ClPE4TOM1FeaJiwTXvApq4gWaSgTLq6nU3PPHAIQDN4=
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/loadbalancer/loadbalancer.go

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

88
"github.com/stackitcloud/stackit-sdk-go/core/utils"
9-
"github.com/stackitcloud/stackit-sdk-go/services/loadbalancer"
9+
loadbalancer "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api"
1010
)
1111

1212
func main() {
@@ -23,15 +23,15 @@ func main() {
2323
}
2424

2525
// List the load balancer instances for your project
26-
listInstancesResp, err := loadbalancerClient.ListLoadBalancers(context.Background(), projectId, region).Execute()
26+
listInstancesResp, err := loadbalancerClient.DefaultAPI.ListLoadBalancers(context.Background(), projectId, region).Execute()
2727
if err != nil {
2828
fmt.Fprintf(os.Stderr, "Error when calling `ListLoadBalancers`: %v\n", err)
2929
os.Exit(1)
3030
}
3131
if listInstancesResp.LoadBalancers == nil {
3232
fmt.Printf("Current project does not have any load balancer instances.\n")
3333
} else {
34-
lbs := *listInstancesResp.LoadBalancers
34+
lbs := listInstancesResp.LoadBalancers
3535
fmt.Printf("Number of instances: %v\n", len(lbs))
3636
}
3737

@@ -41,25 +41,25 @@ func main() {
4141
Options: &loadbalancer.LoadBalancerOptions{
4242
PrivateNetworkOnly: utils.Ptr(true),
4343
},
44-
Networks: &[]loadbalancer.Network{
44+
Networks: []loadbalancer.Network{
4545
{
4646
NetworkId: utils.Ptr("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"),
47-
Role: utils.Ptr(loadbalancer.NETWORKROLE_LISTENERS_AND_TARGETS),
47+
Role: utils.Ptr("ROLE_LISTENERS_AND_TARGETS"),
4848
},
4949
},
50-
Listeners: &[]loadbalancer.Listener{
50+
Listeners: []loadbalancer.Listener{
5151
{
5252
DisplayName: utils.Ptr("example-listener"),
53-
Port: utils.Ptr(int64(1)),
54-
Protocol: utils.Ptr(loadbalancer.LISTENERPROTOCOL_TCP),
53+
Port: utils.Ptr(int32(1)),
54+
Protocol: utils.Ptr("PROTOCOL_TCP"),
5555
TargetPool: utils.Ptr("example-target-pool"),
5656
},
5757
},
58-
TargetPools: &[]loadbalancer.TargetPool{
58+
TargetPools: []loadbalancer.TargetPool{
5959
{
6060
Name: utils.Ptr("example-target-pool"),
61-
TargetPort: utils.Ptr(int64(1)),
62-
Targets: &[]loadbalancer.Target{
61+
TargetPort: utils.Ptr(int32(1)),
62+
Targets: []loadbalancer.Target{
6363
{
6464
DisplayName: utils.Ptr("example-target"),
6565
Ip: utils.Ptr("x.x.x.x"),
@@ -68,7 +68,7 @@ func main() {
6868
},
6969
},
7070
}
71-
createLoadBalancerRes, err := loadbalancerClient.CreateLoadBalancer(context.Background(), projectId, region).CreateLoadBalancerPayload(createLoadBalancerPayload).XRequestID("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").Execute()
71+
createLoadBalancerRes, err := loadbalancerClient.DefaultAPI.CreateLoadBalancer(context.Background(), projectId, region).CreateLoadBalancerPayload(createLoadBalancerPayload).XRequestID("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").Execute()
7272
if err != nil {
7373
fmt.Fprintf(os.Stderr, "Error when calling `CreateLoadBalancer`: %v\n", err)
7474
os.Exit(1)

services/loadbalancer/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## v1.9.0
2+
- **Feature:** Introduction of multi API version support for the loadbalancer 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 loadbalancer v1 API
4+
- `v2api`: New package which can be used for communication with the loadbalancer v2 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
## v1.8.0
29
- **Feature:** Add new fields `AltPort` and `HttpHealthCheck` to `ActiveHealthCheck`
310

services/loadbalancer/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.8.0
1+
v1.9.0

0 commit comments

Comments
 (0)