diff --git a/Makefile b/Makefile index a3a4286b..e7dc734b 100644 --- a/Makefile +++ b/Makefile @@ -124,7 +124,7 @@ verify-image-stackit-csi-plugin: image-stackit-csi-plugin @docker run -v ./tools/csi-deps-check.sh:/tools/csi-deps-check.sh --entrypoint=/tools/csi-deps-check.sh $(REGISTRY)/$(REPO)/stackit-csi-plugin-dev:$(VERSION) # generate mock types for the following services (space-separated list) -MOCK_SERVICES := iaas loadbalancer +MOCK_SERVICES := iaas .PHONY: mocks mocks: $(MOCKGEN) @@ -136,6 +136,9 @@ mocks: $(MOCKGEN) INTERFACES=`go doc -all github.com/stackitcloud/stackit-sdk-go/services/$$service | grep '^type Api.* interface' | sed -n 's/^type \(.*\) interface.*/\1/p' | paste -sd,`,DefaultApi; \ $(MOCKGEN) -destination ./pkg/mock/$$service/$$service.go -package $$service github.com/stackitcloud/stackit-sdk-go/services/$$service $$INTERFACES; \ done + + @$(MOCKGEN) -destination ./pkg/mock/loadbalancer/loadbalancer.go -package loadbalancer github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api DefaultAPI + @$(MOCKGEN) -destination ./pkg/stackit/iaas_mock.go -package stackit ./pkg/stackit IaasClient @$(MOCKGEN) -destination ./pkg/stackit/loadbalancer_mock.go -package stackit ./pkg/stackit LoadbalancerClient @$(MOCKGEN) -destination ./pkg/stackit/server_mock.go -package stackit ./pkg/stackit NodeClient diff --git a/go.mod b/go.mod index bfe77fcf..6d7e9463 100644 --- a/go.mod +++ b/go.mod @@ -13,9 +13,9 @@ require ( github.com/prometheus/client_golang v1.23.2 github.com/spf13/cobra v1.10.2 github.com/spf13/pflag v1.0.10 - github.com/stackitcloud/stackit-sdk-go/core v0.23.0 + github.com/stackitcloud/stackit-sdk-go/core v0.24.0 github.com/stackitcloud/stackit-sdk-go/services/iaas v1.3.5 - github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.8.0 + github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.11.1 go.uber.org/mock v0.6.0 golang.org/x/sync v0.20.0 golang.org/x/sys v0.42.0 diff --git a/go.sum b/go.sum index d86896a5..75947a9d 100644 --- a/go.sum +++ b/go.sum @@ -186,12 +186,12 @@ github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stackitcloud/cloud-provider v0.35.1-ske-1 h1:Oo71mALP7hh50wAeGOogng2sAsi7AUre4177WS2n9NE= github.com/stackitcloud/cloud-provider v0.35.1-ske-1/go.mod h1:zGF/i9YuBODKxj7szGMMIz4DRnjsDy5mg2JU+XbbULA= -github.com/stackitcloud/stackit-sdk-go/core v0.23.0 h1:zPrOhf3Xe47rKRs1fg/AqKYUiJJRYjdcv+3qsS50mEs= -github.com/stackitcloud/stackit-sdk-go/core v0.23.0/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI= +github.com/stackitcloud/stackit-sdk-go/core v0.24.0 h1:kHCcezCJ5OGSP7RRuGOxD5rF2wejpkEiRr/OdvNcuPQ= +github.com/stackitcloud/stackit-sdk-go/core v0.24.0/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI= github.com/stackitcloud/stackit-sdk-go/services/iaas v1.3.5 h1:W57+XRa8wTLsi5CV9Tqa7mGgt/PvlRM//RurXSmvII8= github.com/stackitcloud/stackit-sdk-go/services/iaas v1.3.5/go.mod h1:lTWjW57eAq1bwfM6nsNinhoBr3MHFW/GaFasdAsYfDM= -github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.8.0 h1:DxrN85V738CRLynu6MULQHO+OXyYnkhVPgoZKULfFIs= -github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.8.0/go.mod h1:ClPE4TOM1FeaJiwTXvApq4gWaSgTLq6nU3PPHAIQDN4= +github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.11.1 h1:8hLLCP4n9w3K3dqJaKF1PnMpX4qjR8UQL3gDr80hgDI= +github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.11.1/go.mod h1:vqTjmecQ4+oVWzeo9tCOUZ3TrpIIzM+C0apC7cdAD0Y= github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.18.5 h1:MZ5aTO2NQ1Jecmi67ByGskve5nKXHl91fE+z+vFjxt4= github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.18.5/go.mod h1:CJLmdqWvJm5/3+lXPDKu8k4WXs2UG8euGoqQX5xE79k= github.com/stoewer/go-strcase v1.3.1 h1:iS0MdW+kVTxgMoE1LAZyMiYJFKlOzLooE4MxjirtkAs= diff --git a/pkg/ccm/loadbalancer.go b/pkg/ccm/loadbalancer.go index a32e076c..46f485e1 100644 --- a/pkg/ccm/loadbalancer.go +++ b/pkg/ccm/loadbalancer.go @@ -8,7 +8,8 @@ import ( "time" stackitconfig "github.com/stackitcloud/cloud-provider-stackit/pkg/stackit/config" - "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer" + loadbalancer "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api" + lbwait "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api/wait" corev1 "k8s.io/api/core/v1" "k8s.io/client-go/tools/record" cloudprovider "k8s.io/cloud-provider" @@ -158,7 +159,7 @@ func (l *LoadBalancer) EnsureLoadBalancer( //nolint:gocyclo // not really comple PrivateAddress: spec.PrivateAddress, Region: spec.Region, Labels: spec.Labels, - Status: loadbalancer.UpdateLoadBalancerPayloadGetStatusAttributeType(spec.Status), + Status: spec.Status, TargetPools: spec.TargetPools, Version: spec.Version, } @@ -178,10 +179,10 @@ func (l *LoadBalancer) EnsureLoadBalancer( //nolint:gocyclo // not really comple } } - if *lb.Status == loadbalancer.LOADBALANCERSTATUS_ERROR { + if lb.Status != nil && *lb.Status == lbwait.LOADBALANCERSTATUS_ERROR { return nil, fmt.Errorf("the load balancer is in an error state") } - if *lb.Status != loadbalancer.LOADBALANCERSTATUS_READY { + if lb.Status == nil || *lb.Status != lbwait.LOADBALANCERSTATUS_READY { return nil, api.NewRetryError("waiting for load balancer to become ready. This error is normal while the load balancer starts.", retryDuration) } @@ -221,7 +222,7 @@ func (l *LoadBalancer) createLoadBalancer(ctx context.Context, clusterName strin return nil, createErr } - if lb.Status == nil || *lb.Status != loadbalancer.LOADBALANCERSTATUS_READY { + if lb.Status == nil || *lb.Status != lbwait.LOADBALANCERSTATUS_READY { return nil, api.NewRetryError("waiting for load balancer to become ready. This error is normal while the load balancer starts.", retryDuration) } @@ -245,7 +246,7 @@ func (l *LoadBalancer) UpdateLoadBalancer(ctx context.Context, clusterName strin l.recorder.Event(service, event.Type, event.Reason, event.Message) } - for _, pool := range *spec.TargetPools { + for _, pool := range spec.TargetPools { err := l.client.UpdateTargetPool(ctx, l.projectID, l.GetLoadBalancerName(ctx, clusterName, service), *pool.Name, loadbalancer.UpdateTargetPoolPayload(pool)) if err != nil { return fmt.Errorf("failed to update target pool %q: %w", *pool.Name, err) @@ -274,16 +275,16 @@ func (l *LoadBalancer) EnsureLoadBalancerDeleted( return nil case err != nil: return err - case lb.Status != nil && *lb.Status == loadbalancer.LOADBALANCERSTATUS_TERMINATING: + case lb.Status != nil && *lb.Status == lbwait.LOADBALANCERSTATUS_TERMINATING: return nil } credentialsRef := getMetricsRemoteWriteRef(lb) if credentialsRef != nil { // The load balancer is updated to remove the credentials reference and hence enable their deletion. - for i := range *lb.Listeners { + for i := range lb.Listeners { // Name is an output only field. - (*lb.Listeners)[i].Name = nil + lb.Listeners[i].Name = nil } externalAddress := lb.ExternalAddress if cmp.UnpackPtr(cmp.UnpackPtr(lb.Options).EphemeralAddress) { @@ -403,13 +404,11 @@ func (l *LoadBalancer) cleanUpCredentials(ctx context.Context, name string) erro if err != nil { return fmt.Errorf("failed to list credentials: %w", err) } - if res.Credentials != nil { - for _, credentials := range *res.Credentials { - if credentials.DisplayName != nil && *credentials.DisplayName == name { - err = l.client.DeleteCredentials(ctx, l.projectID, *credentials.CredentialsRef) - if err != nil { - return fmt.Errorf("failed to delete credentials %q: %w", *credentials.CredentialsRef, err) - } + for _, credentials := range res.Credentials { + if credentials.DisplayName != nil && *credentials.DisplayName == name { + err = l.client.DeleteCredentials(ctx, l.projectID, *credentials.CredentialsRef) + if err != nil { + return fmt.Errorf("failed to delete credentials %q: %w", *credentials.CredentialsRef, err) } } } diff --git a/pkg/ccm/loadbalancer_spec.go b/pkg/ccm/loadbalancer_spec.go index e7ac6cf4..e942a00b 100644 --- a/pkg/ccm/loadbalancer_spec.go +++ b/pkg/ccm/loadbalancer_spec.go @@ -9,7 +9,9 @@ import ( "time" stackitconfig "github.com/stackitcloud/cloud-provider-stackit/pkg/stackit/config" - "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer" + //nolint:staticcheck // Temporary workaround: v2api OpenAPI generator currently misses enum constants; fixed in next NVP. + lbLegacy "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer" + loadbalancer "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api" corev1 "k8s.io/api/core/v1" "github.com/stackitcloud/cloud-provider-stackit/pkg/cmp" @@ -239,7 +241,9 @@ func getPlanID(service *corev1.Service) (planID *string, msgs []string, err erro // lbSpecFromService returns a load balancer specification in the form of a create payload matching the specification of the service, nodes and network. // The property name will be empty and must be set by the caller to produce a valid payload for the API. // An error is returned if the service has invalid options. -func lbSpecFromService( //nolint:funlen,gocyclo // It is long but not complex. +// +//nolint:gocyclo,funlen,staticcheck // Temporary workaround: v2api OpenAPI generator currently misses enum constants; fixed in next NVP. +func lbSpecFromService( service *corev1.Service, nodes []*corev1.Node, opts stackitconfig.LoadBalancerOpts, @@ -247,28 +251,28 @@ func lbSpecFromService( //nolint:funlen,gocyclo // It is long but not complex. ) (*loadbalancer.CreateLoadBalancerPayload, []Event, error) { lb := &loadbalancer.CreateLoadBalancerPayload{ Options: &loadbalancer.LoadBalancerOptions{}, - Networks: &[]loadbalancer.Network{ + Networks: []loadbalancer.Network{ { - Role: new(loadbalancer.NETWORKROLE_LISTENERS_AND_TARGETS), + Role: new(string(lbLegacy.NETWORKROLE_LISTENERS_AND_TARGETS)), NetworkId: &opts.NetworkID, }, }, } if listenerNetwork := service.Annotations[listenerNetworkAnnotation]; listenerNetwork != "" { - lb.Networks = &[]loadbalancer.Network{ + lb.Networks = []loadbalancer.Network{ { - Role: new(loadbalancer.NETWORKROLE_TARGETS), + Role: new(string(lbLegacy.NETWORKROLE_TARGETS)), NetworkId: &opts.NetworkID, }, { - Role: new(loadbalancer.NETWORKROLE_LISTENERS), + Role: new(string(lbLegacy.NETWORKROLE_LISTENERS)), NetworkId: &listenerNetwork, }, } } else { - lb.Networks = &[]loadbalancer.Network{ + lb.Networks = []loadbalancer.Network{ { - Role: new(loadbalancer.NETWORKROLE_LISTENERS_AND_TARGETS), + Role: new(string(lbLegacy.NETWORKROLE_LISTENERS_AND_TARGETS)), NetworkId: &opts.NetworkID, }, } @@ -493,22 +497,22 @@ func lbSpecFromService( //nolint:funlen,gocyclo // It is long but not complex. name = fmt.Sprintf("port-%s-%d", strings.ToLower(string(port.Protocol)), port.Port) } - var protocol loadbalancer.ListenerProtocol + var protocol lbLegacy.ListenerProtocol var tcpOptions *loadbalancer.OptionsTCP var udpOptions *loadbalancer.OptionsUDP switch port.Protocol { case corev1.ProtocolTCP: if proxyProtocolEnableForPort(tcpProxyProtocolEnabled, tcpProxyProtocolPortFilter, port.Port) { - protocol = loadbalancer.LISTENERPROTOCOL_TCP_PROXY + protocol = lbLegacy.LISTENERPROTOCOL_TCP_PROXY } else { - protocol = loadbalancer.LISTENERPROTOCOL_TCP + protocol = lbLegacy.LISTENERPROTOCOL_TCP } tcpOptions = &loadbalancer.OptionsTCP{ IdleTimeout: new(fmt.Sprintf("%.0fs", tcpIdleTimeout.Seconds())), } case corev1.ProtocolUDP: - protocol = loadbalancer.LISTENERPROTOCOL_UDP + protocol = lbLegacy.LISTENERPROTOCOL_UDP udpOptions = &loadbalancer.OptionsUDP{ IdleTimeout: new(fmt.Sprintf("%.0fs", udpIdleTimeout.Seconds())), } @@ -518,33 +522,33 @@ func lbSpecFromService( //nolint:funlen,gocyclo // It is long but not complex. listeners = append(listeners, loadbalancer.Listener{ DisplayName: &name, - Port: new(int64(port.Port)), + Port: new(port.Port), TargetPool: &name, - Protocol: new(protocol), + Protocol: new(string(protocol)), Tcp: tcpOptions, Udp: udpOptions, }) targetPools = append(targetPools, loadbalancer.TargetPool{ Name: &name, - TargetPort: new(int64(port.NodePort)), - Targets: &targets, + TargetPort: new(port.NodePort), + Targets: targets, SessionPersistence: &loadbalancer.SessionPersistence{ UseSourceIpAddress: new(useSourceIP), }, }) } - lb.Listeners = &listeners - lb.TargetPools = &targetPools + lb.Listeners = listeners + lb.TargetPools = targetPools lb.Options.AccessControl = &loadbalancer.LoadbalancerOptionAccessControl{} // For backwards-compatibility, the spec takes precedence over the annotation. if sourceRanges, found := service.Annotations[yawolLoadBalancerSourceRangesAnnotation]; found { r := strings.Split(sourceRanges, ",") - lb.Options.AccessControl.AllowedSourceRanges = &r + lb.Options.AccessControl.AllowedSourceRanges = r } if len(service.Spec.LoadBalancerSourceRanges) > 0 { - lb.Options.AccessControl.AllowedSourceRanges = &service.Spec.LoadBalancerSourceRanges + lb.Options.AccessControl.AllowedSourceRanges = service.Spec.LoadBalancerSourceRanges } if event := checkUnsupportedAnnotations(service); event != nil { @@ -587,6 +591,8 @@ type resultImmutableChanged struct { // compareLBwithSpec checks whether the load balancer fulfills the specification. // If immutableChanged is not nil then spec differs from lb such that an update will fail. // Otherwise, fulfills will indicate whether an update is necessary. +// +//nolint:staticcheck // Temporary workaround: v2api OpenAPI generator currently misses enum constants; fixed in next NVP. func compareLBwithSpec(lb *loadbalancer.LoadBalancer, spec *loadbalancer.CreateLoadBalancerPayload) (fulfills bool, immutableChanged *resultImmutableChanged) { //nolint:gocyclo,funlen,lll // It is long but not complex. // If a mutable property has changed we must still check the rest of the object because if there is an immutable change it must always be returned. fulfills = true @@ -637,11 +643,11 @@ func compareLBwithSpec(lb *loadbalancer.LoadBalancer, spec *loadbalancer.CreateL return false, &resultImmutableChanged{field: ".options.ephemeralAddress", annotation: externalIPAnnotation} } - if cmp.LenSlicePtr(lb.Listeners) != cmp.LenSlicePtr(spec.Listeners) { + if len(lb.Listeners) != len(spec.Listeners) { fulfills = false - } else if lb.Listeners != nil && spec.Listeners != nil { - for i, x := range *lb.Listeners { - y := (*spec.Listeners)[i] + } else { + for i, x := range lb.Listeners { + y := spec.Listeners[i] if !cmp.PtrValEqual(x.DisplayName, y.DisplayName) { fulfills = false } @@ -654,13 +660,13 @@ func compareLBwithSpec(lb *loadbalancer.LoadBalancer, spec *loadbalancer.CreateL if !cmp.PtrValEqual(x.TargetPool, y.TargetPool) { fulfills = false } - if (cmp.UnpackPtr(x.Protocol) == loadbalancer.LISTENERPROTOCOL_TCP || cmp.UnpackPtr(x.Protocol) == loadbalancer.LISTENERPROTOCOL_TCP_PROXY) && + if (cmp.UnpackPtr(x.Protocol) == string(lbLegacy.LISTENERPROTOCOL_TCP) || cmp.UnpackPtr(x.Protocol) == string(lbLegacy.LISTENERPROTOCOL_TCP_PROXY)) && !cmp.PtrValEqualFn(x.Tcp, y.Tcp, func(a, b loadbalancer.OptionsTCP) bool { return cmp.PtrValEqual(a.IdleTimeout, b.IdleTimeout) }) { fulfills = false } - if cmp.UnpackPtr(x.Protocol) == loadbalancer.LISTENERPROTOCOL_UDP && !cmp.PtrValEqualFn(x.Udp, y.Udp, func(a, b loadbalancer.OptionsUDP) bool { + if cmp.UnpackPtr(x.Protocol) == string(lbLegacy.LISTENERPROTOCOL_UDP) && !cmp.PtrValEqualFn(x.Udp, y.Udp, func(a, b loadbalancer.OptionsUDP) bool { return cmp.PtrValEqual(a.IdleTimeout, b.IdleTimeout) }) { fulfills = false @@ -668,26 +674,24 @@ func compareLBwithSpec(lb *loadbalancer.LoadBalancer, spec *loadbalancer.CreateL } } - if cmp.LenSlicePtr(lb.Networks) != cmp.LenSlicePtr(spec.Networks) { + if len(lb.Networks) != len(spec.Networks) { return false, &resultImmutableChanged{field: "len(.networks)", annotation: listenerNetworkAnnotation} } - if cmp.LenSlicePtr(lb.Networks) > 0 { - for i, x := range *lb.Networks { - y := (*spec.Networks)[i] - if !cmp.PtrValEqual(x.NetworkId, y.NetworkId) { - return false, &resultImmutableChanged{field: fmt.Sprintf(".networks[%d].networkId", i), annotation: listenerNetworkAnnotation} - } - if !cmp.PtrValEqual(x.Role, y.Role) { - return false, &resultImmutableChanged{field: fmt.Sprintf(".networks[%d].role", i), annotation: listenerNetworkAnnotation} - } + for i, x := range lb.Networks { + y := spec.Networks[i] + if !cmp.PtrValEqual(x.NetworkId, y.NetworkId) { + return false, &resultImmutableChanged{field: fmt.Sprintf(".networks[%d].networkId", i), annotation: listenerNetworkAnnotation} + } + if !cmp.PtrValEqual(x.Role, y.Role) { + return false, &resultImmutableChanged{field: fmt.Sprintf(".networks[%d].role", i), annotation: listenerNetworkAnnotation} } } - if cmp.LenSlicePtr(lb.TargetPools) != cmp.LenSlicePtr(spec.TargetPools) { + if len(lb.TargetPools) != len(spec.TargetPools) { fulfills = false - } else if lb.TargetPools != nil && spec.TargetPools != nil { - for i, x := range *lb.TargetPools { - y := (*spec.TargetPools)[i] + } else { + for i, x := range lb.TargetPools { + y := spec.TargetPools[i] if !cmp.PtrValEqual(x.Name, y.Name) { fulfills = false } @@ -717,13 +721,7 @@ func compareLBwithSpec(lb *loadbalancer.LoadBalancer, spec *loadbalancer.CreateL }) { fulfills = false } - if x.Targets == nil || y.Targets == nil { - // At this point one pointer is nil. - // We consider nil pointer to be equal to a nil slice and an empty slice. - if cmp.LenSlicePtr(x.Targets) != cmp.LenSlicePtr(y.Targets) { - fulfills = false - } - } else if !cmp.SliceEqualUnordered(*x.Targets, *y.Targets, func(a, b loadbalancer.Target) bool { + if !cmp.SliceEqualUnordered(x.Targets, y.Targets, func(a, b loadbalancer.Target) bool { if !cmp.PtrValEqual(a.DisplayName, b.DisplayName) { return false } @@ -745,8 +743,8 @@ func compareLBwithSpec(lb *loadbalancer.LoadBalancer, spec *loadbalancer.CreateL } if !cmp.SliceEqual( - cmp.UnpackPtr(cmp.UnpackPtr(cmp.UnpackPtr(lb.Options).AccessControl).AllowedSourceRanges), - cmp.UnpackPtr(cmp.UnpackPtr(cmp.UnpackPtr(spec.Options).AccessControl).AllowedSourceRanges), + cmp.UnpackPtr(cmp.UnpackPtr(lb.Options).AccessControl).AllowedSourceRanges, + cmp.UnpackPtr(cmp.UnpackPtr(spec.Options).AccessControl).AllowedSourceRanges, ) { fulfills = false } diff --git a/pkg/ccm/loadbalancer_spec_test.go b/pkg/ccm/loadbalancer_spec_test.go index 2964d35c..bf6fd897 100644 --- a/pkg/ccm/loadbalancer_spec_test.go +++ b/pkg/ccm/loadbalancer_spec_test.go @@ -9,12 +9,15 @@ import ( "github.com/onsi/gomega/types" stackitconfig "github.com/stackitcloud/cloud-provider-stackit/pkg/stackit/config" - "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer" + //nolint:staticcheck // Temporary workaround: v2api OpenAPI generator currently misses enum constants; fixed in next NVP. + lbLegacy "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer" + loadbalancer "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/ptr" ) +//nolint:staticcheck // Temporary workaround: v2api OpenAPI generator currently misses enum constants; fixed in next NVP. var _ = Describe("lbSpecFromService", func() { const ( externalAddress = "123.124.88.99" @@ -221,20 +224,20 @@ var _ = Describe("lbSpecFromService", func() { }, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) Expect(spec).To(PointTo(MatchFields(IgnoreExtras, Fields{ - "Listeners": PointTo(ConsistOf( + "Listeners": ConsistOf( MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("http")), - "Protocol": PointTo(Equal(loadbalancer.LISTENERPROTOCOL_TCP_PROXY)), + "Protocol": PointTo(Equal(string(lbLegacy.LISTENERPROTOCOL_TCP_PROXY))), }), MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("http-alt")), - "Protocol": PointTo(Equal(loadbalancer.LISTENERPROTOCOL_TCP_PROXY)), + "Protocol": PointTo(Equal(string(lbLegacy.LISTENERPROTOCOL_TCP_PROXY))), }), MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("dns")), - "Protocol": PointTo(Equal(loadbalancer.LISTENERPROTOCOL_UDP)), + "Protocol": PointTo(Equal(string(lbLegacy.LISTENERPROTOCOL_UDP))), }), - )), + ), }))) Expect(spec).To(haveConsistentTargetPool()) }) @@ -256,20 +259,20 @@ var _ = Describe("lbSpecFromService", func() { }, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) Expect(spec).To(PointTo(MatchFields(IgnoreExtras, Fields{ - "Listeners": PointTo(ConsistOf( + "Listeners": ConsistOf( MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("http")), - "Protocol": PointTo(Equal(loadbalancer.LISTENERPROTOCOL_TCP_PROXY)), + "Protocol": PointTo(Equal(string(lbLegacy.LISTENERPROTOCOL_TCP_PROXY))), }), MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("http-alt")), - "Protocol": PointTo(Equal(loadbalancer.LISTENERPROTOCOL_TCP_PROXY)), + "Protocol": PointTo(Equal(string(lbLegacy.LISTENERPROTOCOL_TCP_PROXY))), }), MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("https")), - "Protocol": PointTo(Equal(loadbalancer.LISTENERPROTOCOL_TCP)), + "Protocol": PointTo(Equal(string(lbLegacy.LISTENERPROTOCOL_TCP))), }), - )), + ), }))) Expect(spec).To(haveConsistentTargetPool()) }) @@ -289,12 +292,12 @@ var _ = Describe("lbSpecFromService", func() { }, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) Expect(spec).To(PointTo(MatchFields(IgnoreExtras, Fields{ - "Listeners": PointTo(ConsistOf( + "Listeners": ConsistOf( MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("http")), - "Protocol": PointTo(Equal(loadbalancer.LISTENERPROTOCOL_TCP)), + "Protocol": PointTo(Equal(string(lbLegacy.LISTENERPROTOCOL_TCP))), }), - )), + ), }))) Expect(spec).To(haveConsistentTargetPool()) }) @@ -369,20 +372,20 @@ var _ = Describe("lbSpecFromService", func() { }, }, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) - Expect(spec.Listeners).To(PointTo(ConsistOf( + Expect(spec.Listeners).To(ConsistOf( MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("http")), - "Protocol": PointTo(Equal(loadbalancer.LISTENERPROTOCOL_TCP)), + "Protocol": PointTo(Equal(string(lbLegacy.LISTENERPROTOCOL_TCP))), "Port": PointTo(BeNumerically("==", 80)), "TargetPool": PointTo(Equal("http")), }), MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("dns")), - "Protocol": PointTo(Equal(loadbalancer.LISTENERPROTOCOL_UDP)), + "Protocol": PointTo(Equal(string(lbLegacy.LISTENERPROTOCOL_UDP))), "Port": PointTo(BeNumerically("==", 53)), "TargetPool": PointTo(Equal("dns")), }), - ))) + )) Expect(spec).To(haveConsistentTargetPool()) }) @@ -425,7 +428,7 @@ var _ = Describe("lbSpecFromService", func() { } spec, _, err := lbSpecFromService(svc, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) - Expect(spec.Listeners).To(PointTo(ConsistOf(havePortName("port-tcp-80")))) + Expect(spec.Listeners).To(ConsistOf(havePortName("port-tcp-80"))) Expect(spec).To(haveConsistentTargetPool()) }) }) @@ -451,7 +454,7 @@ var _ = Describe("lbSpecFromService", func() { Expect(spec).To(PointTo(MatchFields(IgnoreExtras, Fields{ "Options": PointTo(MatchFields(IgnoreExtras, Fields{ "AccessControl": PointTo(MatchFields(IgnoreExtras, Fields{ - "AllowedSourceRanges": PointTo(Equal([]string{"15.0.0.0/8", "16.0.0.0/8"})), + "AllowedSourceRanges": Equal([]string{"15.0.0.0/8", "16.0.0.0/8"}), })), })), }))) @@ -470,7 +473,7 @@ var _ = Describe("lbSpecFromService", func() { Expect(spec).To(PointTo(MatchFields(IgnoreExtras, Fields{ "Options": PointTo(MatchFields(IgnoreExtras, Fields{ "AccessControl": PointTo(MatchFields(IgnoreExtras, Fields{ - "AllowedSourceRanges": PointTo(Equal([]string{"2.0.0.0/8", "3.0.0.0/8"})), + "AllowedSourceRanges": Equal([]string{"2.0.0.0/8", "3.0.0.0/8"}), })), })), }))) @@ -497,12 +500,12 @@ var _ = Describe("lbSpecFromService", func() { }, }, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) - Expect(spec.TargetPools).To(PointTo(HaveLen(2))) - Expect(spec.TargetPools).To(PointTo(HaveEach( + Expect(spec.TargetPools).To(HaveLen(2)) + Expect(spec.TargetPools).To(HaveEach( haveTargets(ContainElements(loadbalancer.Target{ DisplayName: new("node-1"), Ip: new("10.2.3.4"), - }))))) + })))) }) It("node without internal IP", func() { @@ -530,14 +533,14 @@ var _ = Describe("lbSpecFromService", func() { }, }, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) - Expect(spec.TargetPools).To(PointTo(ConsistOf( + Expect(spec.TargetPools).To(ConsistOf( haveTargets(ConsistOf( // node-2 is missing loadbalancer.Target{ DisplayName: new("node-1"), Ip: new("10.2.3.4"), }, )), - ))) + )) Expect(spec).To(haveConsistentTargetPool()) }) }) @@ -631,7 +634,7 @@ var _ = Describe("lbSpecFromService", func() { }, }, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) - Expect(spec.Listeners).To(PointTo(ConsistOf( + Expect(spec.Listeners).To(ConsistOf( MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("my-tcp-port")), "Tcp": PointTo(MatchFields(IgnoreExtras, Fields{ @@ -646,7 +649,7 @@ var _ = Describe("lbSpecFromService", func() { }), MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("my-tcp-proxy-port")), - "Protocol": PointTo(Equal(loadbalancer.LISTENERPROTOCOL_TCP_PROXY)), + "Protocol": PointTo(Equal(string(lbLegacy.LISTENERPROTOCOL_TCP_PROXY))), "Tcp": PointTo(MatchFields(IgnoreExtras, Fields{ "IdleTimeout": PointTo(Equal("900s")), })), @@ -655,7 +658,7 @@ var _ = Describe("lbSpecFromService", func() { "DisplayName": PointTo(Equal("my-udp-port")), "Tcp": BeNil(), }), - ))) + )) }) It("should set timeout to 60 minutes if no annotation is specified", func() { @@ -676,14 +679,14 @@ var _ = Describe("lbSpecFromService", func() { }, }, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) - Expect(spec.Listeners).To(PointTo(ConsistOf( + Expect(spec.Listeners).To(ConsistOf( MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("my-tcp-port")), "Tcp": PointTo(MatchFields(IgnoreExtras, Fields{ "IdleTimeout": PointTo(Equal("3600s")), })), }), - ))) + )) }) It("should set timeout based on yawol annotation", func() { @@ -705,14 +708,14 @@ var _ = Describe("lbSpecFromService", func() { }, }, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) - Expect(spec.Listeners).To(PointTo(ConsistOf( + Expect(spec.Listeners).To(ConsistOf( MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("my-tcp-port")), "Tcp": PointTo(MatchFields(IgnoreExtras, Fields{ "IdleTimeout": PointTo(Equal("180s")), })), }), - ))) + )) }) It("should error on non-compatible timeouts", func() { @@ -777,14 +780,14 @@ var _ = Describe("lbSpecFromService", func() { }, }, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) - Expect(spec.Listeners).To(PointTo(ConsistOf( + Expect(spec.Listeners).To(ConsistOf( MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("my-tcp-port")), "Tcp": PointTo(MatchFields(IgnoreExtras, Fields{ "IdleTimeout": PointTo(Equal("3600s")), })), }), - ))) + )) }) }) @@ -930,7 +933,7 @@ var _ = Describe("lbSpecFromService", func() { }, }, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) - Expect(spec.Listeners).To(PointTo(ConsistOf( + Expect(spec.Listeners).To(ConsistOf( MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("my-tcp-port")), "Udp": BeNil(), @@ -947,7 +950,7 @@ var _ = Describe("lbSpecFromService", func() { "IdleTimeout": PointTo(Equal("900s")), })), }), - ))) + )) }) It("should set timeout to 2 minutes if no annotation is specified", func() { @@ -968,14 +971,14 @@ var _ = Describe("lbSpecFromService", func() { }, }, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) - Expect(spec.Listeners).To(PointTo(ConsistOf( + Expect(spec.Listeners).To(ConsistOf( MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("my-udp-port")), "Udp": PointTo(MatchFields(IgnoreExtras, Fields{ "IdleTimeout": PointTo(Equal("120s")), })), }), - ))) + )) }) It("should set timeout based on yawol annotation", func() { @@ -997,14 +1000,14 @@ var _ = Describe("lbSpecFromService", func() { }, }, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) - Expect(spec.Listeners).To(PointTo(ConsistOf( + Expect(spec.Listeners).To(ConsistOf( MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("my-udp-port")), "Udp": PointTo(MatchFields(IgnoreExtras, Fields{ "IdleTimeout": PointTo(Equal("180s")), })), }), - ))) + )) }) It("should error on non-compatible timeouts", func() { @@ -1069,14 +1072,14 @@ var _ = Describe("lbSpecFromService", func() { }, }, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) - Expect(spec.Listeners).To(PointTo(ConsistOf( + Expect(spec.Listeners).To(ConsistOf( MatchFields(IgnoreExtras, Fields{ "DisplayName": PointTo(Equal("my-udp-port")), "Udp": PointTo(MatchFields(IgnoreExtras, Fields{ "IdleTimeout": PointTo(Equal("120s")), })), }), - ))) + )) }) }) Context("Session Persistence", func() { @@ -1098,13 +1101,13 @@ var _ = Describe("lbSpecFromService", func() { }, }, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) - Expect(spec.TargetPools).To(PointTo(HaveEach( + Expect(spec.TargetPools).To(HaveEach( MatchFields(IgnoreExtras, Fields{ "SessionPersistence": PointTo(MatchFields(IgnoreExtras, Fields{ "UseSourceIpAddress": PointTo(BeTrue()), })), }), - ))) + )) }) It("should disable session persistence when annotation is false", func() { @@ -1125,13 +1128,13 @@ var _ = Describe("lbSpecFromService", func() { }, }, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) - Expect(spec.TargetPools).To(PointTo(HaveEach( + Expect(spec.TargetPools).To(HaveEach( MatchFields(IgnoreExtras, Fields{ "SessionPersistence": PointTo(MatchFields(IgnoreExtras, Fields{ "UseSourceIpAddress": PointTo(BeFalse()), })), }), - ))) + )) }) It("should error on invalid value for useSourceIpAddress", func() { @@ -1155,10 +1158,10 @@ var _ = Describe("lbSpecFromService", func() { }, }, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) - Expect(spec.Networks).To(PointTo(ConsistOf(MatchFields(IgnoreExtras, Fields{ + Expect(spec.Networks).To(ConsistOf(MatchFields(IgnoreExtras, Fields{ "NetworkId": PointTo(Equal("my-network")), - "Role": PointTo(Equal(loadbalancer.NETWORKROLE_LISTENERS_AND_TARGETS)), - })))) + "Role": PointTo(Equal(string(lbLegacy.NETWORKROLE_LISTENERS_AND_TARGETS))), + }))) }) It("should create a load balancer with two networks with dedicated roles", func() { @@ -1170,16 +1173,16 @@ var _ = Describe("lbSpecFromService", func() { }, }, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) - Expect(spec.Networks).To(PointTo(ConsistOf( + Expect(spec.Networks).To(ConsistOf( MatchFields(IgnoreExtras, Fields{ "NetworkId": PointTo(Equal("my-network")), - "Role": PointTo(Equal(loadbalancer.NETWORKROLE_TARGETS)), + "Role": PointTo(Equal(string(lbLegacy.NETWORKROLE_TARGETS))), }), MatchFields(IgnoreExtras, Fields{ "NetworkId": PointTo(Equal("my-listener-network")), - "Role": PointTo(Equal(loadbalancer.NETWORKROLE_LISTENERS)), + "Role": PointTo(Equal(string(lbLegacy.NETWORKROLE_LISTENERS))), }), - ))) + )) }) It("should configure a public service without existing IP as ephemeral", func() { @@ -1191,7 +1194,7 @@ var _ = Describe("lbSpecFromService", func() { // haveTargets succeeds if actual is a target pool and the list of targets matches matcher. func haveTargets(matcher types.GomegaMatcher) types.GomegaMatcher { - return WithTransform(func(pool loadbalancer.TargetPool) *[]loadbalancer.Target { return pool.Targets }, PointTo(matcher)) + return WithTransform(func(pool loadbalancer.TargetPool) []loadbalancer.Target { return pool.Targets }, matcher) } // havePortName succeeds if actual is a listener whose display name matches name. @@ -1202,8 +1205,8 @@ func havePortName(name string) types.GomegaMatcher { // haveConsistentTargetPool succeeds if the target pools of each listener exist. func haveConsistentTargetPool() types.GomegaMatcher { return WithTransform(func(l *loadbalancer.CreateLoadBalancerPayload) bool { - for _, lb := range *l.Listeners { - contains := slices.ContainsFunc(*l.TargetPools, func(t loadbalancer.TargetPool) bool { + for _, lb := range l.Listeners { + contains := slices.ContainsFunc(l.TargetPools, func(t loadbalancer.TargetPool) bool { return ptr.Equal(lb.TargetPool, t.Name) }) if !contains { @@ -1221,6 +1224,7 @@ type compareLBwithSpecTest struct { spec *loadbalancer.CreateLoadBalancerPayload } +//nolint:staticcheck // Temporary workaround: v2api OpenAPI generator currently misses enum constants; fixed in next NVP. var _ = DescribeTable("compareLBwithSpec", func(t *compareLBwithSpecTest) { fulfills, immutableChanged := compareLBwithSpec(t.lb, t.spec) @@ -1367,7 +1371,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Listeners: &[]loadbalancer.Listener{ + Listeners: []loadbalancer.Listener{ {}, {}, }, }, @@ -1375,7 +1379,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Listeners: &[]loadbalancer.Listener{ + Listeners: []loadbalancer.Listener{ {}, }, }, @@ -1386,7 +1390,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Listeners: &[]loadbalancer.Listener{ + Listeners: []loadbalancer.Listener{ {DisplayName: new("port-a")}, }, }, @@ -1394,7 +1398,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Listeners: &[]loadbalancer.Listener{ + Listeners: []loadbalancer.Listener{ {DisplayName: new("port-b")}, }, }, @@ -1405,16 +1409,16 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Listeners: &[]loadbalancer.Listener{ - {Port: new(int64(80))}, + Listeners: []loadbalancer.Listener{ + {Port: new(int32(80))}, }, }, spec: &loadbalancer.CreateLoadBalancerPayload{ Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Listeners: &[]loadbalancer.Listener{ - {Port: new(int64(443))}, + Listeners: []loadbalancer.Listener{ + {Port: new(int32(443))}, }, }, }), @@ -1424,16 +1428,16 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Listeners: &[]loadbalancer.Listener{ - {Protocol: new(loadbalancer.LISTENERPROTOCOL_TCP)}, + Listeners: []loadbalancer.Listener{ + {Protocol: new(string(lbLegacy.LISTENERPROTOCOL_TCP))}, }, }, spec: &loadbalancer.CreateLoadBalancerPayload{ Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Listeners: &[]loadbalancer.Listener{ - {Protocol: new(loadbalancer.LISTENERPROTOCOL_TCP_PROXY)}, + Listeners: []loadbalancer.Listener{ + {Protocol: new(string(lbLegacy.LISTENERPROTOCOL_TCP_PROXY))}, }, }, }), @@ -1443,9 +1447,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Listeners: &[]loadbalancer.Listener{ + Listeners: []loadbalancer.Listener{ { - Protocol: new(loadbalancer.LISTENERPROTOCOL_TCP), + Protocol: new(string(lbLegacy.LISTENERPROTOCOL_TCP)), Tcp: &loadbalancer.OptionsTCP{ IdleTimeout: new("60s"), }, @@ -1456,9 +1460,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Listeners: &[]loadbalancer.Listener{ + Listeners: []loadbalancer.Listener{ { - Protocol: new(loadbalancer.LISTENERPROTOCOL_TCP), + Protocol: new(string(lbLegacy.LISTENERPROTOCOL_TCP)), Tcp: &loadbalancer.OptionsTCP{ IdleTimeout: new("120s"), }, @@ -1472,9 +1476,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Listeners: &[]loadbalancer.Listener{ + Listeners: []loadbalancer.Listener{ { - Protocol: new(loadbalancer.LISTENERPROTOCOL_UDP), + Protocol: new(string(lbLegacy.LISTENERPROTOCOL_UDP)), Udp: &loadbalancer.OptionsUDP{ IdleTimeout: new("60s"), }, @@ -1485,9 +1489,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Listeners: &[]loadbalancer.Listener{ + Listeners: []loadbalancer.Listener{ { - Protocol: new(loadbalancer.LISTENERPROTOCOL_UDP), + Protocol: new(string(lbLegacy.LISTENERPROTOCOL_UDP)), Udp: &loadbalancer.OptionsUDP{ IdleTimeout: new("120s"), }, @@ -1501,9 +1505,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Listeners: &[]loadbalancer.Listener{ + Listeners: []loadbalancer.Listener{ { - Protocol: new(loadbalancer.LISTENERPROTOCOL_TCP_PROXY), + Protocol: new(string(lbLegacy.LISTENERPROTOCOL_TCP_PROXY)), Tcp: &loadbalancer.OptionsTCP{ IdleTimeout: new("60s"), }, @@ -1514,9 +1518,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Listeners: &[]loadbalancer.Listener{ + Listeners: []loadbalancer.Listener{ { - Protocol: new(loadbalancer.LISTENERPROTOCOL_TCP_PROXY), + Protocol: new(string(lbLegacy.LISTENERPROTOCOL_TCP_PROXY)), Tcp: &loadbalancer.OptionsTCP{ IdleTimeout: new("120s"), }, @@ -1530,7 +1534,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Listeners: &[]loadbalancer.Listener{ + Listeners: []loadbalancer.Listener{ {TargetPool: new("target-pool-a")}, }, }, @@ -1538,7 +1542,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Listeners: &[]loadbalancer.Listener{ + Listeners: []loadbalancer.Listener{ {TargetPool: new("target-pool-b")}, }, }, @@ -1555,7 +1559,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Networks: &[]loadbalancer.Network{ + Networks: []loadbalancer.Network{ {}, }, }, @@ -1566,7 +1570,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Networks: &[]loadbalancer.Network{ + Networks: []loadbalancer.Network{ { NetworkId: new("my-network"), }, @@ -1576,7 +1580,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Networks: &[]loadbalancer.Network{ + Networks: []loadbalancer.Network{ { NetworkId: new("other-network"), }, @@ -1589,9 +1593,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Networks: &[]loadbalancer.Network{ + Networks: []loadbalancer.Network{ { - Role: new(loadbalancer.NETWORKROLE_LISTENERS), + Role: new(string(lbLegacy.NETWORKROLE_LISTENERS)), }, }, }, @@ -1599,9 +1603,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - Networks: &[]loadbalancer.Network{ + Networks: []loadbalancer.Network{ { - Role: new(loadbalancer.NETWORKROLE_TARGETS), + Role: new(string(lbLegacy.NETWORKROLE_TARGETS)), }, }, }, @@ -1612,7 +1616,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ {}, }, }, @@ -1620,7 +1624,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ {}, {}, }, }, @@ -1631,7 +1635,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ { Name: new("target-pool-a"), }, @@ -1641,7 +1645,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ { Name: new("target-pool-b"), }, @@ -1654,9 +1658,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ { - TargetPort: new(int64(80)), + TargetPort: new(int32(80)), }, }, }, @@ -1664,9 +1668,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ { - TargetPort: new(int64(443)), + TargetPort: new(int32(443)), }, }, }, @@ -1677,9 +1681,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ { - Targets: &[]loadbalancer.Target{ + Targets: []loadbalancer.Target{ { DisplayName: new("node-a"), Ip: new("10.0.0.1"), @@ -1696,9 +1700,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ { - Targets: &[]loadbalancer.Target{ + Targets: []loadbalancer.Target{ { DisplayName: new("node-b"), Ip: new("10.0.0.2"), @@ -1718,9 +1722,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ { - Targets: &[]loadbalancer.Target{ + Targets: []loadbalancer.Target{ { DisplayName: new("node-a"), Ip: new("10.0.0.1"), @@ -1733,9 +1737,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ { - Targets: &[]loadbalancer.Target{ + Targets: []loadbalancer.Target{ { DisplayName: new("node-b"), Ip: new("10.0.0.2"), @@ -1755,9 +1759,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ { - Targets: &[]loadbalancer.Target{ + Targets: []loadbalancer.Target{ { DisplayName: new("node-a"), Ip: new("10.0.0.1"), @@ -1770,9 +1774,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ { - Targets: &[]loadbalancer.Target{ + Targets: []loadbalancer.Target{ { DisplayName: new("node-a"), Ip: new("10.0.0.2"), @@ -1788,7 +1792,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ { Targets: nil, }, @@ -1798,9 +1802,9 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ { - Targets: &[]loadbalancer.Target{}, + Targets: []loadbalancer.Target{}, }, }, }, @@ -1811,7 +1815,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ { ActiveHealthCheck: &loadbalancer.ActiveHealthCheck{ Interval: new("2"), @@ -1823,7 +1827,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ { ActiveHealthCheck: &loadbalancer.ActiveHealthCheck{ Interval: new("3"), @@ -1838,7 +1842,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ { ActiveHealthCheck: &loadbalancer.ActiveHealthCheck{ UnhealthyThreshold: nil, @@ -1850,10 +1854,10 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{ + TargetPools: []loadbalancer.TargetPool{ { ActiveHealthCheck: &loadbalancer.ActiveHealthCheck{ - UnhealthyThreshold: new(int64(3)), + UnhealthyThreshold: new(int32(3)), }, }, }, @@ -1890,7 +1894,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), AccessControl: &loadbalancer.LoadbalancerOptionAccessControl{ - AllowedSourceRanges: new([]string{"10.0.0.0/24"}), + AllowedSourceRanges: []string{"10.0.0.0/24"}, }, }, }, @@ -1906,7 +1910,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), AccessControl: &loadbalancer.LoadbalancerOptionAccessControl{ - AllowedSourceRanges: new([]string{"10.5.0.0/24"}), + AllowedSourceRanges: []string{"10.5.0.0/24"}, }, }, }, @@ -1914,7 +1918,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), AccessControl: &loadbalancer.LoadbalancerOptionAccessControl{ - AllowedSourceRanges: new([]string{"10.0.0.0/24"}), + AllowedSourceRanges: []string{"10.0.0.0/24"}, }, }, }, @@ -1925,7 +1929,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{{ + TargetPools: []loadbalancer.TargetPool{{ SessionPersistence: &loadbalancer.SessionPersistence{ UseSourceIpAddress: new(true), }, @@ -1935,7 +1939,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{{ + TargetPools: []loadbalancer.TargetPool{{ SessionPersistence: &loadbalancer.SessionPersistence{ UseSourceIpAddress: new(true), }, @@ -1948,7 +1952,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{{ + TargetPools: []loadbalancer.TargetPool{{ SessionPersistence: &loadbalancer.SessionPersistence{ UseSourceIpAddress: new(false), }, @@ -1958,7 +1962,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{{ + TargetPools: []loadbalancer.TargetPool{{ SessionPersistence: &loadbalancer.SessionPersistence{ UseSourceIpAddress: new(false), }, @@ -1971,7 +1975,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{{ + TargetPools: []loadbalancer.TargetPool{{ SessionPersistence: &loadbalancer.SessionPersistence{ UseSourceIpAddress: new(false), }, @@ -1981,7 +1985,7 @@ var _ = DescribeTable("compareLBwithSpec", Options: &loadbalancer.LoadBalancerOptions{ PrivateNetworkOnly: new(true), }, - TargetPools: &[]loadbalancer.TargetPool{{ + TargetPools: []loadbalancer.TargetPool{{ SessionPersistence: &loadbalancer.SessionPersistence{ UseSourceIpAddress: new(true), }, diff --git a/pkg/ccm/loadbalancer_test.go b/pkg/ccm/loadbalancer_test.go index b673e543..6a26d6a1 100644 --- a/pkg/ccm/loadbalancer_test.go +++ b/pkg/ccm/loadbalancer_test.go @@ -8,7 +8,8 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" stackitconfig "github.com/stackitcloud/cloud-provider-stackit/pkg/stackit/config" - "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer" + loadbalancer "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api" + lbwait "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api/wait" "go.uber.org/mock/gomock" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -110,13 +111,13 @@ var _ = Describe("LoadBalancer", func() { convertToLB := func(spec *loadbalancer.CreateLoadBalancerPayload) *loadbalancer.LoadBalancer { return &loadbalancer.LoadBalancer{ - Errors: &[]loadbalancer.LoadBalancerError{}, + Errors: []loadbalancer.LoadBalancerError{}, ExternalAddress: spec.ExternalAddress, Listeners: spec.Listeners, Name: spec.Name, Networks: spec.Networks, Options: spec.Options, - Status: new(loadbalancer.LOADBALANCERSTATUS_READY), + Status: new(lbwait.LOADBALANCERSTATUS_READY), TargetPools: spec.TargetPools, Version: new("current-version"), } @@ -200,7 +201,7 @@ var _ = Describe("LoadBalancer", func() { It("should create a load balancer with observability configured", func() { mockClient.EXPECT().GetLoadBalancer(gomock.Any(), projectID, gomock.Any()).Return(nil, stackit.ErrorNotFound) mockClient.EXPECT().ListCredentials(gomock.Any(), projectID).Return(&loadbalancer.ListCredentialsResponse{ - Credentials: &[]loadbalancer.CredentialsResponse{}, + Credentials: []loadbalancer.CredentialsResponse{}, }, nil) // TODO: match payload mockClient.EXPECT().CreateCredentials(gomock.Any(), projectID, gomock.Any()).MinTimes(1). @@ -231,14 +232,14 @@ var _ = Describe("LoadBalancer", func() { }) Expect(err).NotTo(HaveOccurred()) myLb := &loadbalancer.LoadBalancer{ - Errors: &[]loadbalancer.LoadBalancerError{}, + Errors: []loadbalancer.LoadBalancerError{}, ExternalAddress: spec.ExternalAddress, Listeners: spec.Listeners, Name: spec.Name, Networks: spec.Networks, Options: spec.Options, PrivateAddress: spec.PrivateAddress, - Status: new(loadbalancer.LOADBALANCERSTATUS_READY), + Status: new(lbwait.LOADBALANCERSTATUS_READY), TargetPools: spec.TargetPools, Version: new("current-version"), PlanId: new("p10"), @@ -257,14 +258,14 @@ var _ = Describe("LoadBalancer", func() { spec, _, err := lbSpecFromService(svc, []*corev1.Node{}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) myLb := &loadbalancer.LoadBalancer{ - Errors: &[]loadbalancer.LoadBalancerError{}, + Errors: []loadbalancer.LoadBalancerError{}, ExternalAddress: spec.ExternalAddress, Listeners: spec.Listeners, Name: spec.Name, Networks: spec.Networks, Options: spec.Options, PrivateAddress: spec.PrivateAddress, - Status: new(loadbalancer.LOADBALANCERSTATUS_READY), + Status: new(lbwait.LOADBALANCERSTATUS_READY), TargetPools: spec.TargetPools, Version: new("current-version"), } @@ -315,14 +316,14 @@ var _ = Describe("LoadBalancer", func() { spec, _, err := lbSpecFromService(svc, []*corev1.Node{nodeA}, lbOpts, nil) Expect(err).NotTo(HaveOccurred()) myLb := &loadbalancer.LoadBalancer{ - Errors: &[]loadbalancer.LoadBalancerError{}, + Errors: []loadbalancer.LoadBalancerError{}, ExternalAddress: spec.ExternalAddress, Listeners: spec.Listeners, Name: spec.Name, Networks: spec.Networks, Options: spec.Options, PrivateAddress: spec.PrivateAddress, - Status: new(loadbalancer.LOADBALANCERSTATUS_READY), + Status: new(lbwait.LOADBALANCERSTATUS_READY), TargetPools: spec.TargetPools, Version: new("current-version"), } @@ -351,14 +352,14 @@ var _ = Describe("LoadBalancer", func() { }) Expect(err).NotTo(HaveOccurred()) myLb := &loadbalancer.LoadBalancer{ - Errors: &[]loadbalancer.LoadBalancerError{}, + Errors: []loadbalancer.LoadBalancerError{}, ExternalAddress: spec.ExternalAddress, Listeners: spec.Listeners, Name: spec.Name, Networks: spec.Networks, Options: spec.Options, PrivateAddress: spec.PrivateAddress, - Status: new(loadbalancer.LOADBALANCERSTATUS_READY), + Status: new(lbwait.LOADBALANCERSTATUS_READY), TargetPools: spec.TargetPools, Version: new("current-version"), } @@ -391,7 +392,7 @@ var _ = Describe("LoadBalancer", func() { It("should trigger load balancer deletion", func() { mockClient.EXPECT().GetLoadBalancer(gomock.Any(), projectID, gomock.Any()).Return(&loadbalancer.LoadBalancer{}, nil) mockClient.EXPECT().ListCredentials(gomock.Any(), projectID).Return(&loadbalancer.ListCredentialsResponse{ - Credentials: &[]loadbalancer.CredentialsResponse{}, + Credentials: []loadbalancer.CredentialsResponse{}, }, nil) mockClient.EXPECT().DeleteLoadBalancer(gomock.Any(), projectID, gomock.Any()).MinTimes(1).Return(nil) @@ -410,7 +411,7 @@ var _ = Describe("LoadBalancer", func() { It("should finalize deletion if load balancer is state terminating", func() { mockClient.EXPECT().GetLoadBalancer(gomock.Any(), projectID, gomock.Any()).Return(&loadbalancer.LoadBalancer{ - Status: new(loadbalancer.LOADBALANCERSTATUS_TERMINATING), + Status: new(lbwait.LOADBALANCERSTATUS_TERMINATING), }, nil) err := loadBalancer.EnsureLoadBalancerDeleted(context.Background(), clusterName, minimalLoadBalancerService()) @@ -430,7 +431,7 @@ var _ = Describe("LoadBalancer", func() { It("should trigger load balancer deletion", func() { mockClient.EXPECT().GetLoadBalancer(gomock.Any(), projectID, gomock.Any()).Return(&loadbalancer.LoadBalancer{}, nil) mockClient.EXPECT().ListCredentials(gomock.Any(), projectID).Return(&loadbalancer.ListCredentialsResponse{ - Credentials: &[]loadbalancer.CredentialsResponse{}, + Credentials: []loadbalancer.CredentialsResponse{}, }, nil) mockClient.EXPECT().DeleteLoadBalancer(gomock.Any(), projectID, gomock.Any()).MinTimes(1).Return(nil) @@ -456,7 +457,7 @@ var _ = Describe("LoadBalancer", func() { EphemeralAddress: new(false), }, ExternalAddress: new("8.8.4.4"), - Listeners: &[]loadbalancer.Listener{}, + Listeners: []loadbalancer.Listener{}, }, nil) gomock.InOrder( mockClient.EXPECT().UpdateLoadBalancer(gomock.Any(), projectID, name, gomock.All( @@ -464,7 +465,7 @@ var _ = Describe("LoadBalancer", func() { )).MinTimes(1).Return(&loadbalancer.LoadBalancer{}, nil), mockClient.EXPECT().DeleteCredentials(gomock.Any(), projectID, sampleCredentialsRef).MinTimes(1).Return(nil), mockClient.EXPECT().ListCredentials(gomock.Any(), projectID).Return(&loadbalancer.ListCredentialsResponse{ - Credentials: &[]loadbalancer.CredentialsResponse{}, + Credentials: []loadbalancer.CredentialsResponse{}, }, nil), mockClient.EXPECT().DeleteLoadBalancer(gomock.Any(), projectID, name).MinTimes(1).Return(nil), ) @@ -490,7 +491,7 @@ var _ = Describe("LoadBalancer", func() { EphemeralAddress: new(true), }, ExternalAddress: new("0.0.0.0 (ephemeral)"), - Listeners: &[]loadbalancer.Listener{}, + Listeners: []loadbalancer.Listener{}, }, nil) gomock.InOrder( mockClient.EXPECT().UpdateLoadBalancer(gomock.Any(), projectID, name, gomock.All( @@ -498,7 +499,7 @@ var _ = Describe("LoadBalancer", func() { )).MinTimes(1).Return(&loadbalancer.LoadBalancer{}, nil), mockClient.EXPECT().DeleteCredentials(gomock.Any(), projectID, sampleCredentialsRef).MinTimes(1).Return(nil), mockClient.EXPECT().ListCredentials(gomock.Any(), projectID).Return(&loadbalancer.ListCredentialsResponse{ - Credentials: &[]loadbalancer.CredentialsResponse{}, + Credentials: []loadbalancer.CredentialsResponse{}, }, nil), mockClient.EXPECT().DeleteLoadBalancer(gomock.Any(), projectID, name).MinTimes(1).Return(nil), ) @@ -584,7 +585,7 @@ var _ = Describe("LoadBalancer", func() { It("should create credentials if they do not exist", func() { mockClient.EXPECT().ListCredentials(gomock.Any(), projectID).Return(&loadbalancer.ListCredentialsResponse{ - Credentials: &[]loadbalancer.CredentialsResponse{}, + Credentials: []loadbalancer.CredentialsResponse{}, }, nil) mockClient.EXPECT().CreateCredentials(gomock.Any(), projectID, gomock.Any()).MinTimes(1).Return(&loadbalancer.CreateCredentialsResponse{ Credential: &loadbalancer.CredentialsResponse{ @@ -607,7 +608,7 @@ var _ = Describe("LoadBalancer", func() { It("should return error if creating new credentials fails", func() { mockClient.EXPECT().ListCredentials(gomock.Any(), projectID).Return(&loadbalancer.ListCredentialsResponse{ - Credentials: &[]loadbalancer.CredentialsResponse{}, + Credentials: []loadbalancer.CredentialsResponse{}, }, nil) errTest := errors.New("delete credentials test error") mockClient.EXPECT().CreateCredentials(gomock.Any(), projectID, gomock.Any()).MinTimes(1).Return(nil, errTest) @@ -623,7 +624,7 @@ var _ = Describe("LoadBalancer", func() { It("should delete matching and only matching observability credentials", func() { gomock.InOrder( mockClient.EXPECT().ListCredentials(gomock.Any(), projectID).Return(&loadbalancer.ListCredentialsResponse{ - Credentials: &[]loadbalancer.CredentialsResponse{ + Credentials: []loadbalancer.CredentialsResponse{ { CredentialsRef: new("matching-1"), DisplayName: new("my-loadbalancer"), diff --git a/pkg/ccm/stackit.go b/pkg/ccm/stackit.go index 80ca2761..729c6446 100644 --- a/pkg/ccm/stackit.go +++ b/pkg/ccm/stackit.go @@ -9,7 +9,7 @@ import ( stackitconfig "github.com/stackitcloud/cloud-provider-stackit/pkg/stackit/config" sdkconfig "github.com/stackitcloud/stackit-sdk-go/core/config" "github.com/stackitcloud/stackit-sdk-go/services/iaas" - "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer" + loadbalancer "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api" "gopkg.in/yaml.v3" corev1 "k8s.io/api/core/v1" "k8s.io/client-go/kubernetes/scheme" @@ -139,7 +139,7 @@ func NewCloudControllerManager(cfg *stackitconfig.CCMConfig, obs *MetricsRemoteW if err != nil { return nil, err } - client, err := stackit.NewLoadbalancerClient(innerClient, cfg.Global.Region) + client, err := stackit.NewLoadbalancerClient(innerClient.DefaultAPI, cfg.Global.Region) if err != nil { return nil, err } diff --git a/pkg/mock/loadbalancer/loadbalancer.go b/pkg/mock/loadbalancer/loadbalancer.go index 7812a003..a54cd092 100644 --- a/pkg/mock/loadbalancer/loadbalancer.go +++ b/pkg/mock/loadbalancer/loadbalancer.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/stackitcloud/stackit-sdk-go/services/loadbalancer (interfaces: ApiCreateCredentialsRequest,ApiCreateLoadBalancerRequest,ApiDeleteCredentialsRequest,ApiDeleteLoadBalancerRequest,ApiGetCredentialsRequest,ApiGetLoadBalancerRequest,ApiGetQuotaRequest,ApiListCredentialsRequest,ApiListLoadBalancersRequest,ApiListPlansRequest,ApiUpdateCredentialsRequest,ApiUpdateLoadBalancerRequest,ApiUpdateTargetPoolRequest,DefaultApi) +// Source: github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api (interfaces: DefaultAPI) // // Generated by this command: // -// mockgen -destination ./pkg/mock/loadbalancer/loadbalancer.go -package loadbalancer github.com/stackitcloud/stackit-sdk-go/services/loadbalancer ApiCreateCredentialsRequest,ApiCreateLoadBalancerRequest,ApiDeleteCredentialsRequest,ApiDeleteLoadBalancerRequest,ApiGetCredentialsRequest,ApiGetLoadBalancerRequest,ApiGetQuotaRequest,ApiListCredentialsRequest,ApiListLoadBalancersRequest,ApiListPlansRequest,ApiUpdateCredentialsRequest,ApiUpdateLoadBalancerRequest,ApiUpdateTargetPoolRequest,DefaultApi +// mockgen -destination ./pkg/mock/loadbalancer/loadbalancer.go -package loadbalancer github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api DefaultAPI // // Package loadbalancer is a generated GoMock package. @@ -13,1040 +13,407 @@ import ( context "context" reflect "reflect" - loadbalancer "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer" + v2api "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api" gomock "go.uber.org/mock/gomock" ) -// MockApiCreateCredentialsRequest is a mock of ApiCreateCredentialsRequest interface. -type MockApiCreateCredentialsRequest struct { +// MockDefaultAPI is a mock of DefaultAPI interface. +type MockDefaultAPI struct { ctrl *gomock.Controller - recorder *MockApiCreateCredentialsRequestMockRecorder + recorder *MockDefaultAPIMockRecorder isgomock struct{} } -// MockApiCreateCredentialsRequestMockRecorder is the mock recorder for MockApiCreateCredentialsRequest. -type MockApiCreateCredentialsRequestMockRecorder struct { - mock *MockApiCreateCredentialsRequest +// MockDefaultAPIMockRecorder is the mock recorder for MockDefaultAPI. +type MockDefaultAPIMockRecorder struct { + mock *MockDefaultAPI } -// NewMockApiCreateCredentialsRequest creates a new mock instance. -func NewMockApiCreateCredentialsRequest(ctrl *gomock.Controller) *MockApiCreateCredentialsRequest { - mock := &MockApiCreateCredentialsRequest{ctrl: ctrl} - mock.recorder = &MockApiCreateCredentialsRequestMockRecorder{mock} +// NewMockDefaultAPI creates a new mock instance. +func NewMockDefaultAPI(ctrl *gomock.Controller) *MockDefaultAPI { + mock := &MockDefaultAPI{ctrl: ctrl} + mock.recorder = &MockDefaultAPIMockRecorder{mock} return mock } // EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockApiCreateCredentialsRequest) EXPECT() *MockApiCreateCredentialsRequestMockRecorder { - return m.recorder -} - -// CreateCredentialsPayload mocks base method. -func (m *MockApiCreateCredentialsRequest) CreateCredentialsPayload(createCredentialsPayload loadbalancer.CreateCredentialsPayload) loadbalancer.ApiCreateCredentialsRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateCredentialsPayload", createCredentialsPayload) - ret0, _ := ret[0].(loadbalancer.ApiCreateCredentialsRequest) - return ret0 -} - -// CreateCredentialsPayload indicates an expected call of CreateCredentialsPayload. -func (mr *MockApiCreateCredentialsRequestMockRecorder) CreateCredentialsPayload(createCredentialsPayload any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCredentialsPayload", reflect.TypeOf((*MockApiCreateCredentialsRequest)(nil).CreateCredentialsPayload), createCredentialsPayload) -} - -// Execute mocks base method. -func (m *MockApiCreateCredentialsRequest) Execute() (*loadbalancer.CreateCredentialsResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Execute") - ret0, _ := ret[0].(*loadbalancer.CreateCredentialsResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Execute indicates an expected call of Execute. -func (mr *MockApiCreateCredentialsRequestMockRecorder) Execute() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockApiCreateCredentialsRequest)(nil).Execute)) -} - -// XRequestID mocks base method. -func (m *MockApiCreateCredentialsRequest) XRequestID(xRequestID string) loadbalancer.ApiCreateCredentialsRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "XRequestID", xRequestID) - ret0, _ := ret[0].(loadbalancer.ApiCreateCredentialsRequest) - return ret0 -} - -// XRequestID indicates an expected call of XRequestID. -func (mr *MockApiCreateCredentialsRequestMockRecorder) XRequestID(xRequestID any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "XRequestID", reflect.TypeOf((*MockApiCreateCredentialsRequest)(nil).XRequestID), xRequestID) -} - -// MockApiCreateLoadBalancerRequest is a mock of ApiCreateLoadBalancerRequest interface. -type MockApiCreateLoadBalancerRequest struct { - ctrl *gomock.Controller - recorder *MockApiCreateLoadBalancerRequestMockRecorder - isgomock struct{} -} - -// MockApiCreateLoadBalancerRequestMockRecorder is the mock recorder for MockApiCreateLoadBalancerRequest. -type MockApiCreateLoadBalancerRequestMockRecorder struct { - mock *MockApiCreateLoadBalancerRequest -} - -// NewMockApiCreateLoadBalancerRequest creates a new mock instance. -func NewMockApiCreateLoadBalancerRequest(ctrl *gomock.Controller) *MockApiCreateLoadBalancerRequest { - mock := &MockApiCreateLoadBalancerRequest{ctrl: ctrl} - mock.recorder = &MockApiCreateLoadBalancerRequestMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockApiCreateLoadBalancerRequest) EXPECT() *MockApiCreateLoadBalancerRequestMockRecorder { - return m.recorder -} - -// CreateLoadBalancerPayload mocks base method. -func (m *MockApiCreateLoadBalancerRequest) CreateLoadBalancerPayload(createLoadBalancerPayload loadbalancer.CreateLoadBalancerPayload) loadbalancer.ApiCreateLoadBalancerRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateLoadBalancerPayload", createLoadBalancerPayload) - ret0, _ := ret[0].(loadbalancer.ApiCreateLoadBalancerRequest) - return ret0 -} - -// CreateLoadBalancerPayload indicates an expected call of CreateLoadBalancerPayload. -func (mr *MockApiCreateLoadBalancerRequestMockRecorder) CreateLoadBalancerPayload(createLoadBalancerPayload any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateLoadBalancerPayload", reflect.TypeOf((*MockApiCreateLoadBalancerRequest)(nil).CreateLoadBalancerPayload), createLoadBalancerPayload) -} - -// Execute mocks base method. -func (m *MockApiCreateLoadBalancerRequest) Execute() (*loadbalancer.LoadBalancer, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Execute") - ret0, _ := ret[0].(*loadbalancer.LoadBalancer) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Execute indicates an expected call of Execute. -func (mr *MockApiCreateLoadBalancerRequestMockRecorder) Execute() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockApiCreateLoadBalancerRequest)(nil).Execute)) -} - -// XRequestID mocks base method. -func (m *MockApiCreateLoadBalancerRequest) XRequestID(xRequestID string) loadbalancer.ApiCreateLoadBalancerRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "XRequestID", xRequestID) - ret0, _ := ret[0].(loadbalancer.ApiCreateLoadBalancerRequest) - return ret0 -} - -// XRequestID indicates an expected call of XRequestID. -func (mr *MockApiCreateLoadBalancerRequestMockRecorder) XRequestID(xRequestID any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "XRequestID", reflect.TypeOf((*MockApiCreateLoadBalancerRequest)(nil).XRequestID), xRequestID) -} - -// MockApiDeleteCredentialsRequest is a mock of ApiDeleteCredentialsRequest interface. -type MockApiDeleteCredentialsRequest struct { - ctrl *gomock.Controller - recorder *MockApiDeleteCredentialsRequestMockRecorder - isgomock struct{} -} - -// MockApiDeleteCredentialsRequestMockRecorder is the mock recorder for MockApiDeleteCredentialsRequest. -type MockApiDeleteCredentialsRequestMockRecorder struct { - mock *MockApiDeleteCredentialsRequest -} - -// NewMockApiDeleteCredentialsRequest creates a new mock instance. -func NewMockApiDeleteCredentialsRequest(ctrl *gomock.Controller) *MockApiDeleteCredentialsRequest { - mock := &MockApiDeleteCredentialsRequest{ctrl: ctrl} - mock.recorder = &MockApiDeleteCredentialsRequestMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockApiDeleteCredentialsRequest) EXPECT() *MockApiDeleteCredentialsRequestMockRecorder { - return m.recorder -} - -// Execute mocks base method. -func (m *MockApiDeleteCredentialsRequest) Execute() (map[string]any, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Execute") - ret0, _ := ret[0].(map[string]any) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Execute indicates an expected call of Execute. -func (mr *MockApiDeleteCredentialsRequestMockRecorder) Execute() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockApiDeleteCredentialsRequest)(nil).Execute)) -} - -// MockApiDeleteLoadBalancerRequest is a mock of ApiDeleteLoadBalancerRequest interface. -type MockApiDeleteLoadBalancerRequest struct { - ctrl *gomock.Controller - recorder *MockApiDeleteLoadBalancerRequestMockRecorder - isgomock struct{} -} - -// MockApiDeleteLoadBalancerRequestMockRecorder is the mock recorder for MockApiDeleteLoadBalancerRequest. -type MockApiDeleteLoadBalancerRequestMockRecorder struct { - mock *MockApiDeleteLoadBalancerRequest -} - -// NewMockApiDeleteLoadBalancerRequest creates a new mock instance. -func NewMockApiDeleteLoadBalancerRequest(ctrl *gomock.Controller) *MockApiDeleteLoadBalancerRequest { - mock := &MockApiDeleteLoadBalancerRequest{ctrl: ctrl} - mock.recorder = &MockApiDeleteLoadBalancerRequestMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockApiDeleteLoadBalancerRequest) EXPECT() *MockApiDeleteLoadBalancerRequestMockRecorder { - return m.recorder -} - -// Execute mocks base method. -func (m *MockApiDeleteLoadBalancerRequest) Execute() (map[string]any, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Execute") - ret0, _ := ret[0].(map[string]any) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Execute indicates an expected call of Execute. -func (mr *MockApiDeleteLoadBalancerRequestMockRecorder) Execute() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockApiDeleteLoadBalancerRequest)(nil).Execute)) -} - -// MockApiGetCredentialsRequest is a mock of ApiGetCredentialsRequest interface. -type MockApiGetCredentialsRequest struct { - ctrl *gomock.Controller - recorder *MockApiGetCredentialsRequestMockRecorder - isgomock struct{} -} - -// MockApiGetCredentialsRequestMockRecorder is the mock recorder for MockApiGetCredentialsRequest. -type MockApiGetCredentialsRequestMockRecorder struct { - mock *MockApiGetCredentialsRequest -} - -// NewMockApiGetCredentialsRequest creates a new mock instance. -func NewMockApiGetCredentialsRequest(ctrl *gomock.Controller) *MockApiGetCredentialsRequest { - mock := &MockApiGetCredentialsRequest{ctrl: ctrl} - mock.recorder = &MockApiGetCredentialsRequestMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockApiGetCredentialsRequest) EXPECT() *MockApiGetCredentialsRequestMockRecorder { - return m.recorder -} - -// Execute mocks base method. -func (m *MockApiGetCredentialsRequest) Execute() (*loadbalancer.GetCredentialsResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Execute") - ret0, _ := ret[0].(*loadbalancer.GetCredentialsResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Execute indicates an expected call of Execute. -func (mr *MockApiGetCredentialsRequestMockRecorder) Execute() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockApiGetCredentialsRequest)(nil).Execute)) -} - -// MockApiGetLoadBalancerRequest is a mock of ApiGetLoadBalancerRequest interface. -type MockApiGetLoadBalancerRequest struct { - ctrl *gomock.Controller - recorder *MockApiGetLoadBalancerRequestMockRecorder - isgomock struct{} -} - -// MockApiGetLoadBalancerRequestMockRecorder is the mock recorder for MockApiGetLoadBalancerRequest. -type MockApiGetLoadBalancerRequestMockRecorder struct { - mock *MockApiGetLoadBalancerRequest -} - -// NewMockApiGetLoadBalancerRequest creates a new mock instance. -func NewMockApiGetLoadBalancerRequest(ctrl *gomock.Controller) *MockApiGetLoadBalancerRequest { - mock := &MockApiGetLoadBalancerRequest{ctrl: ctrl} - mock.recorder = &MockApiGetLoadBalancerRequestMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockApiGetLoadBalancerRequest) EXPECT() *MockApiGetLoadBalancerRequestMockRecorder { - return m.recorder -} - -// Execute mocks base method. -func (m *MockApiGetLoadBalancerRequest) Execute() (*loadbalancer.LoadBalancer, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Execute") - ret0, _ := ret[0].(*loadbalancer.LoadBalancer) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Execute indicates an expected call of Execute. -func (mr *MockApiGetLoadBalancerRequestMockRecorder) Execute() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockApiGetLoadBalancerRequest)(nil).Execute)) -} - -// MockApiGetQuotaRequest is a mock of ApiGetQuotaRequest interface. -type MockApiGetQuotaRequest struct { - ctrl *gomock.Controller - recorder *MockApiGetQuotaRequestMockRecorder - isgomock struct{} -} - -// MockApiGetQuotaRequestMockRecorder is the mock recorder for MockApiGetQuotaRequest. -type MockApiGetQuotaRequestMockRecorder struct { - mock *MockApiGetQuotaRequest -} - -// NewMockApiGetQuotaRequest creates a new mock instance. -func NewMockApiGetQuotaRequest(ctrl *gomock.Controller) *MockApiGetQuotaRequest { - mock := &MockApiGetQuotaRequest{ctrl: ctrl} - mock.recorder = &MockApiGetQuotaRequestMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockApiGetQuotaRequest) EXPECT() *MockApiGetQuotaRequestMockRecorder { - return m.recorder -} - -// Execute mocks base method. -func (m *MockApiGetQuotaRequest) Execute() (*loadbalancer.GetQuotaResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Execute") - ret0, _ := ret[0].(*loadbalancer.GetQuotaResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Execute indicates an expected call of Execute. -func (mr *MockApiGetQuotaRequestMockRecorder) Execute() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockApiGetQuotaRequest)(nil).Execute)) -} - -// MockApiListCredentialsRequest is a mock of ApiListCredentialsRequest interface. -type MockApiListCredentialsRequest struct { - ctrl *gomock.Controller - recorder *MockApiListCredentialsRequestMockRecorder - isgomock struct{} -} - -// MockApiListCredentialsRequestMockRecorder is the mock recorder for MockApiListCredentialsRequest. -type MockApiListCredentialsRequestMockRecorder struct { - mock *MockApiListCredentialsRequest -} - -// NewMockApiListCredentialsRequest creates a new mock instance. -func NewMockApiListCredentialsRequest(ctrl *gomock.Controller) *MockApiListCredentialsRequest { - mock := &MockApiListCredentialsRequest{ctrl: ctrl} - mock.recorder = &MockApiListCredentialsRequestMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockApiListCredentialsRequest) EXPECT() *MockApiListCredentialsRequestMockRecorder { - return m.recorder -} - -// Execute mocks base method. -func (m *MockApiListCredentialsRequest) Execute() (*loadbalancer.ListCredentialsResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Execute") - ret0, _ := ret[0].(*loadbalancer.ListCredentialsResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Execute indicates an expected call of Execute. -func (mr *MockApiListCredentialsRequestMockRecorder) Execute() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockApiListCredentialsRequest)(nil).Execute)) -} - -// MockApiListLoadBalancersRequest is a mock of ApiListLoadBalancersRequest interface. -type MockApiListLoadBalancersRequest struct { - ctrl *gomock.Controller - recorder *MockApiListLoadBalancersRequestMockRecorder - isgomock struct{} -} - -// MockApiListLoadBalancersRequestMockRecorder is the mock recorder for MockApiListLoadBalancersRequest. -type MockApiListLoadBalancersRequestMockRecorder struct { - mock *MockApiListLoadBalancersRequest -} - -// NewMockApiListLoadBalancersRequest creates a new mock instance. -func NewMockApiListLoadBalancersRequest(ctrl *gomock.Controller) *MockApiListLoadBalancersRequest { - mock := &MockApiListLoadBalancersRequest{ctrl: ctrl} - mock.recorder = &MockApiListLoadBalancersRequestMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockApiListLoadBalancersRequest) EXPECT() *MockApiListLoadBalancersRequestMockRecorder { - return m.recorder -} - -// Execute mocks base method. -func (m *MockApiListLoadBalancersRequest) Execute() (*loadbalancer.ListLoadBalancersResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Execute") - ret0, _ := ret[0].(*loadbalancer.ListLoadBalancersResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Execute indicates an expected call of Execute. -func (mr *MockApiListLoadBalancersRequestMockRecorder) Execute() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockApiListLoadBalancersRequest)(nil).Execute)) -} - -// PageId mocks base method. -func (m *MockApiListLoadBalancersRequest) PageId(pageId string) loadbalancer.ApiListLoadBalancersRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PageId", pageId) - ret0, _ := ret[0].(loadbalancer.ApiListLoadBalancersRequest) - return ret0 -} - -// PageId indicates an expected call of PageId. -func (mr *MockApiListLoadBalancersRequestMockRecorder) PageId(pageId any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PageId", reflect.TypeOf((*MockApiListLoadBalancersRequest)(nil).PageId), pageId) -} - -// PageSize mocks base method. -func (m *MockApiListLoadBalancersRequest) PageSize(pageSize string) loadbalancer.ApiListLoadBalancersRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PageSize", pageSize) - ret0, _ := ret[0].(loadbalancer.ApiListLoadBalancersRequest) - return ret0 -} - -// PageSize indicates an expected call of PageSize. -func (mr *MockApiListLoadBalancersRequestMockRecorder) PageSize(pageSize any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PageSize", reflect.TypeOf((*MockApiListLoadBalancersRequest)(nil).PageSize), pageSize) -} - -// MockApiListPlansRequest is a mock of ApiListPlansRequest interface. -type MockApiListPlansRequest struct { - ctrl *gomock.Controller - recorder *MockApiListPlansRequestMockRecorder - isgomock struct{} -} - -// MockApiListPlansRequestMockRecorder is the mock recorder for MockApiListPlansRequest. -type MockApiListPlansRequestMockRecorder struct { - mock *MockApiListPlansRequest -} - -// NewMockApiListPlansRequest creates a new mock instance. -func NewMockApiListPlansRequest(ctrl *gomock.Controller) *MockApiListPlansRequest { - mock := &MockApiListPlansRequest{ctrl: ctrl} - mock.recorder = &MockApiListPlansRequestMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockApiListPlansRequest) EXPECT() *MockApiListPlansRequestMockRecorder { - return m.recorder -} - -// Execute mocks base method. -func (m *MockApiListPlansRequest) Execute() (*loadbalancer.ListPlansResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Execute") - ret0, _ := ret[0].(*loadbalancer.ListPlansResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Execute indicates an expected call of Execute. -func (mr *MockApiListPlansRequestMockRecorder) Execute() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockApiListPlansRequest)(nil).Execute)) -} - -// MockApiUpdateCredentialsRequest is a mock of ApiUpdateCredentialsRequest interface. -type MockApiUpdateCredentialsRequest struct { - ctrl *gomock.Controller - recorder *MockApiUpdateCredentialsRequestMockRecorder - isgomock struct{} -} - -// MockApiUpdateCredentialsRequestMockRecorder is the mock recorder for MockApiUpdateCredentialsRequest. -type MockApiUpdateCredentialsRequestMockRecorder struct { - mock *MockApiUpdateCredentialsRequest -} - -// NewMockApiUpdateCredentialsRequest creates a new mock instance. -func NewMockApiUpdateCredentialsRequest(ctrl *gomock.Controller) *MockApiUpdateCredentialsRequest { - mock := &MockApiUpdateCredentialsRequest{ctrl: ctrl} - mock.recorder = &MockApiUpdateCredentialsRequestMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockApiUpdateCredentialsRequest) EXPECT() *MockApiUpdateCredentialsRequestMockRecorder { - return m.recorder -} - -// Execute mocks base method. -func (m *MockApiUpdateCredentialsRequest) Execute() (*loadbalancer.UpdateCredentialsResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Execute") - ret0, _ := ret[0].(*loadbalancer.UpdateCredentialsResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Execute indicates an expected call of Execute. -func (mr *MockApiUpdateCredentialsRequestMockRecorder) Execute() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockApiUpdateCredentialsRequest)(nil).Execute)) -} - -// UpdateCredentialsPayload mocks base method. -func (m *MockApiUpdateCredentialsRequest) UpdateCredentialsPayload(updateCredentialsPayload loadbalancer.UpdateCredentialsPayload) loadbalancer.ApiUpdateCredentialsRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateCredentialsPayload", updateCredentialsPayload) - ret0, _ := ret[0].(loadbalancer.ApiUpdateCredentialsRequest) - return ret0 -} - -// UpdateCredentialsPayload indicates an expected call of UpdateCredentialsPayload. -func (mr *MockApiUpdateCredentialsRequestMockRecorder) UpdateCredentialsPayload(updateCredentialsPayload any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateCredentialsPayload", reflect.TypeOf((*MockApiUpdateCredentialsRequest)(nil).UpdateCredentialsPayload), updateCredentialsPayload) -} - -// MockApiUpdateLoadBalancerRequest is a mock of ApiUpdateLoadBalancerRequest interface. -type MockApiUpdateLoadBalancerRequest struct { - ctrl *gomock.Controller - recorder *MockApiUpdateLoadBalancerRequestMockRecorder - isgomock struct{} -} - -// MockApiUpdateLoadBalancerRequestMockRecorder is the mock recorder for MockApiUpdateLoadBalancerRequest. -type MockApiUpdateLoadBalancerRequestMockRecorder struct { - mock *MockApiUpdateLoadBalancerRequest -} - -// NewMockApiUpdateLoadBalancerRequest creates a new mock instance. -func NewMockApiUpdateLoadBalancerRequest(ctrl *gomock.Controller) *MockApiUpdateLoadBalancerRequest { - mock := &MockApiUpdateLoadBalancerRequest{ctrl: ctrl} - mock.recorder = &MockApiUpdateLoadBalancerRequestMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockApiUpdateLoadBalancerRequest) EXPECT() *MockApiUpdateLoadBalancerRequestMockRecorder { - return m.recorder -} - -// Execute mocks base method. -func (m *MockApiUpdateLoadBalancerRequest) Execute() (*loadbalancer.LoadBalancer, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Execute") - ret0, _ := ret[0].(*loadbalancer.LoadBalancer) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Execute indicates an expected call of Execute. -func (mr *MockApiUpdateLoadBalancerRequestMockRecorder) Execute() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockApiUpdateLoadBalancerRequest)(nil).Execute)) -} - -// UpdateLoadBalancerPayload mocks base method. -func (m *MockApiUpdateLoadBalancerRequest) UpdateLoadBalancerPayload(updateLoadBalancerPayload loadbalancer.UpdateLoadBalancerPayload) loadbalancer.ApiUpdateLoadBalancerRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateLoadBalancerPayload", updateLoadBalancerPayload) - ret0, _ := ret[0].(loadbalancer.ApiUpdateLoadBalancerRequest) - return ret0 -} - -// UpdateLoadBalancerPayload indicates an expected call of UpdateLoadBalancerPayload. -func (mr *MockApiUpdateLoadBalancerRequestMockRecorder) UpdateLoadBalancerPayload(updateLoadBalancerPayload any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateLoadBalancerPayload", reflect.TypeOf((*MockApiUpdateLoadBalancerRequest)(nil).UpdateLoadBalancerPayload), updateLoadBalancerPayload) -} - -// MockApiUpdateTargetPoolRequest is a mock of ApiUpdateTargetPoolRequest interface. -type MockApiUpdateTargetPoolRequest struct { - ctrl *gomock.Controller - recorder *MockApiUpdateTargetPoolRequestMockRecorder - isgomock struct{} -} - -// MockApiUpdateTargetPoolRequestMockRecorder is the mock recorder for MockApiUpdateTargetPoolRequest. -type MockApiUpdateTargetPoolRequestMockRecorder struct { - mock *MockApiUpdateTargetPoolRequest -} - -// NewMockApiUpdateTargetPoolRequest creates a new mock instance. -func NewMockApiUpdateTargetPoolRequest(ctrl *gomock.Controller) *MockApiUpdateTargetPoolRequest { - mock := &MockApiUpdateTargetPoolRequest{ctrl: ctrl} - mock.recorder = &MockApiUpdateTargetPoolRequestMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockApiUpdateTargetPoolRequest) EXPECT() *MockApiUpdateTargetPoolRequestMockRecorder { - return m.recorder -} - -// Execute mocks base method. -func (m *MockApiUpdateTargetPoolRequest) Execute() (*loadbalancer.TargetPool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Execute") - ret0, _ := ret[0].(*loadbalancer.TargetPool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Execute indicates an expected call of Execute. -func (mr *MockApiUpdateTargetPoolRequestMockRecorder) Execute() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockApiUpdateTargetPoolRequest)(nil).Execute)) -} - -// UpdateTargetPoolPayload mocks base method. -func (m *MockApiUpdateTargetPoolRequest) UpdateTargetPoolPayload(updateTargetPoolPayload loadbalancer.UpdateTargetPoolPayload) loadbalancer.ApiUpdateTargetPoolRequest { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateTargetPoolPayload", updateTargetPoolPayload) - ret0, _ := ret[0].(loadbalancer.ApiUpdateTargetPoolRequest) - return ret0 -} - -// UpdateTargetPoolPayload indicates an expected call of UpdateTargetPoolPayload. -func (mr *MockApiUpdateTargetPoolRequestMockRecorder) UpdateTargetPoolPayload(updateTargetPoolPayload any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTargetPoolPayload", reflect.TypeOf((*MockApiUpdateTargetPoolRequest)(nil).UpdateTargetPoolPayload), updateTargetPoolPayload) -} - -// MockDefaultApi is a mock of DefaultApi interface. -type MockDefaultApi struct { - ctrl *gomock.Controller - recorder *MockDefaultApiMockRecorder - isgomock struct{} -} - -// MockDefaultApiMockRecorder is the mock recorder for MockDefaultApi. -type MockDefaultApiMockRecorder struct { - mock *MockDefaultApi -} - -// NewMockDefaultApi creates a new mock instance. -func NewMockDefaultApi(ctrl *gomock.Controller) *MockDefaultApi { - mock := &MockDefaultApi{ctrl: ctrl} - mock.recorder = &MockDefaultApiMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockDefaultApi) EXPECT() *MockDefaultApiMockRecorder { +func (m *MockDefaultAPI) EXPECT() *MockDefaultAPIMockRecorder { return m.recorder } // CreateCredentials mocks base method. -func (m *MockDefaultApi) CreateCredentials(ctx context.Context, projectId, region string) loadbalancer.ApiCreateCredentialsRequest { +func (m *MockDefaultAPI) CreateCredentials(ctx context.Context, projectId, region string) v2api.ApiCreateCredentialsRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateCredentials", ctx, projectId, region) - ret0, _ := ret[0].(loadbalancer.ApiCreateCredentialsRequest) + ret0, _ := ret[0].(v2api.ApiCreateCredentialsRequest) return ret0 } // CreateCredentials indicates an expected call of CreateCredentials. -func (mr *MockDefaultApiMockRecorder) CreateCredentials(ctx, projectId, region any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) CreateCredentials(ctx, projectId, region any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCredentials", reflect.TypeOf((*MockDefaultApi)(nil).CreateCredentials), ctx, projectId, region) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCredentials", reflect.TypeOf((*MockDefaultAPI)(nil).CreateCredentials), ctx, projectId, region) } // CreateCredentialsExecute mocks base method. -func (m *MockDefaultApi) CreateCredentialsExecute(ctx context.Context, projectId, region string) (*loadbalancer.CreateCredentialsResponse, error) { +func (m *MockDefaultAPI) CreateCredentialsExecute(r v2api.ApiCreateCredentialsRequest) (*v2api.CreateCredentialsResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateCredentialsExecute", ctx, projectId, region) - ret0, _ := ret[0].(*loadbalancer.CreateCredentialsResponse) + ret := m.ctrl.Call(m, "CreateCredentialsExecute", r) + ret0, _ := ret[0].(*v2api.CreateCredentialsResponse) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateCredentialsExecute indicates an expected call of CreateCredentialsExecute. -func (mr *MockDefaultApiMockRecorder) CreateCredentialsExecute(ctx, projectId, region any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) CreateCredentialsExecute(r any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCredentialsExecute", reflect.TypeOf((*MockDefaultApi)(nil).CreateCredentialsExecute), ctx, projectId, region) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCredentialsExecute", reflect.TypeOf((*MockDefaultAPI)(nil).CreateCredentialsExecute), r) } // CreateLoadBalancer mocks base method. -func (m *MockDefaultApi) CreateLoadBalancer(ctx context.Context, projectId, region string) loadbalancer.ApiCreateLoadBalancerRequest { +func (m *MockDefaultAPI) CreateLoadBalancer(ctx context.Context, projectId, region string) v2api.ApiCreateLoadBalancerRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateLoadBalancer", ctx, projectId, region) - ret0, _ := ret[0].(loadbalancer.ApiCreateLoadBalancerRequest) + ret0, _ := ret[0].(v2api.ApiCreateLoadBalancerRequest) return ret0 } // CreateLoadBalancer indicates an expected call of CreateLoadBalancer. -func (mr *MockDefaultApiMockRecorder) CreateLoadBalancer(ctx, projectId, region any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) CreateLoadBalancer(ctx, projectId, region any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateLoadBalancer", reflect.TypeOf((*MockDefaultApi)(nil).CreateLoadBalancer), ctx, projectId, region) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateLoadBalancer", reflect.TypeOf((*MockDefaultAPI)(nil).CreateLoadBalancer), ctx, projectId, region) } // CreateLoadBalancerExecute mocks base method. -func (m *MockDefaultApi) CreateLoadBalancerExecute(ctx context.Context, projectId, region string) (*loadbalancer.LoadBalancer, error) { +func (m *MockDefaultAPI) CreateLoadBalancerExecute(r v2api.ApiCreateLoadBalancerRequest) (*v2api.LoadBalancer, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateLoadBalancerExecute", ctx, projectId, region) - ret0, _ := ret[0].(*loadbalancer.LoadBalancer) + ret := m.ctrl.Call(m, "CreateLoadBalancerExecute", r) + ret0, _ := ret[0].(*v2api.LoadBalancer) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateLoadBalancerExecute indicates an expected call of CreateLoadBalancerExecute. -func (mr *MockDefaultApiMockRecorder) CreateLoadBalancerExecute(ctx, projectId, region any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) CreateLoadBalancerExecute(r any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateLoadBalancerExecute", reflect.TypeOf((*MockDefaultApi)(nil).CreateLoadBalancerExecute), ctx, projectId, region) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateLoadBalancerExecute", reflect.TypeOf((*MockDefaultAPI)(nil).CreateLoadBalancerExecute), r) } // DeleteCredentials mocks base method. -func (m *MockDefaultApi) DeleteCredentials(ctx context.Context, projectId, region, credentialsRef string) loadbalancer.ApiDeleteCredentialsRequest { +func (m *MockDefaultAPI) DeleteCredentials(ctx context.Context, projectId, region, credentialsRef string) v2api.ApiDeleteCredentialsRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DeleteCredentials", ctx, projectId, region, credentialsRef) - ret0, _ := ret[0].(loadbalancer.ApiDeleteCredentialsRequest) + ret0, _ := ret[0].(v2api.ApiDeleteCredentialsRequest) return ret0 } // DeleteCredentials indicates an expected call of DeleteCredentials. -func (mr *MockDefaultApiMockRecorder) DeleteCredentials(ctx, projectId, region, credentialsRef any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) DeleteCredentials(ctx, projectId, region, credentialsRef any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteCredentials", reflect.TypeOf((*MockDefaultApi)(nil).DeleteCredentials), ctx, projectId, region, credentialsRef) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteCredentials", reflect.TypeOf((*MockDefaultAPI)(nil).DeleteCredentials), ctx, projectId, region, credentialsRef) } // DeleteCredentialsExecute mocks base method. -func (m *MockDefaultApi) DeleteCredentialsExecute(ctx context.Context, projectId, region, credentialsRef string) (map[string]any, error) { +func (m *MockDefaultAPI) DeleteCredentialsExecute(r v2api.ApiDeleteCredentialsRequest) (map[string]any, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteCredentialsExecute", ctx, projectId, region, credentialsRef) + ret := m.ctrl.Call(m, "DeleteCredentialsExecute", r) ret0, _ := ret[0].(map[string]any) ret1, _ := ret[1].(error) return ret0, ret1 } // DeleteCredentialsExecute indicates an expected call of DeleteCredentialsExecute. -func (mr *MockDefaultApiMockRecorder) DeleteCredentialsExecute(ctx, projectId, region, credentialsRef any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) DeleteCredentialsExecute(r any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteCredentialsExecute", reflect.TypeOf((*MockDefaultApi)(nil).DeleteCredentialsExecute), ctx, projectId, region, credentialsRef) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteCredentialsExecute", reflect.TypeOf((*MockDefaultAPI)(nil).DeleteCredentialsExecute), r) } // DeleteLoadBalancer mocks base method. -func (m *MockDefaultApi) DeleteLoadBalancer(ctx context.Context, projectId, region, name string) loadbalancer.ApiDeleteLoadBalancerRequest { +func (m *MockDefaultAPI) DeleteLoadBalancer(ctx context.Context, projectId, region, name string) v2api.ApiDeleteLoadBalancerRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DeleteLoadBalancer", ctx, projectId, region, name) - ret0, _ := ret[0].(loadbalancer.ApiDeleteLoadBalancerRequest) + ret0, _ := ret[0].(v2api.ApiDeleteLoadBalancerRequest) return ret0 } // DeleteLoadBalancer indicates an expected call of DeleteLoadBalancer. -func (mr *MockDefaultApiMockRecorder) DeleteLoadBalancer(ctx, projectId, region, name any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) DeleteLoadBalancer(ctx, projectId, region, name any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteLoadBalancer", reflect.TypeOf((*MockDefaultApi)(nil).DeleteLoadBalancer), ctx, projectId, region, name) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteLoadBalancer", reflect.TypeOf((*MockDefaultAPI)(nil).DeleteLoadBalancer), ctx, projectId, region, name) } // DeleteLoadBalancerExecute mocks base method. -func (m *MockDefaultApi) DeleteLoadBalancerExecute(ctx context.Context, projectId, region, name string) (map[string]any, error) { +func (m *MockDefaultAPI) DeleteLoadBalancerExecute(r v2api.ApiDeleteLoadBalancerRequest) (map[string]any, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteLoadBalancerExecute", ctx, projectId, region, name) + ret := m.ctrl.Call(m, "DeleteLoadBalancerExecute", r) ret0, _ := ret[0].(map[string]any) ret1, _ := ret[1].(error) return ret0, ret1 } // DeleteLoadBalancerExecute indicates an expected call of DeleteLoadBalancerExecute. -func (mr *MockDefaultApiMockRecorder) DeleteLoadBalancerExecute(ctx, projectId, region, name any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) DeleteLoadBalancerExecute(r any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteLoadBalancerExecute", reflect.TypeOf((*MockDefaultApi)(nil).DeleteLoadBalancerExecute), ctx, projectId, region, name) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteLoadBalancerExecute", reflect.TypeOf((*MockDefaultAPI)(nil).DeleteLoadBalancerExecute), r) } // GetCredentials mocks base method. -func (m *MockDefaultApi) GetCredentials(ctx context.Context, projectId, region, credentialsRef string) loadbalancer.ApiGetCredentialsRequest { +func (m *MockDefaultAPI) GetCredentials(ctx context.Context, projectId, region, credentialsRef string) v2api.ApiGetCredentialsRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetCredentials", ctx, projectId, region, credentialsRef) - ret0, _ := ret[0].(loadbalancer.ApiGetCredentialsRequest) + ret0, _ := ret[0].(v2api.ApiGetCredentialsRequest) return ret0 } // GetCredentials indicates an expected call of GetCredentials. -func (mr *MockDefaultApiMockRecorder) GetCredentials(ctx, projectId, region, credentialsRef any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) GetCredentials(ctx, projectId, region, credentialsRef any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCredentials", reflect.TypeOf((*MockDefaultApi)(nil).GetCredentials), ctx, projectId, region, credentialsRef) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCredentials", reflect.TypeOf((*MockDefaultAPI)(nil).GetCredentials), ctx, projectId, region, credentialsRef) } // GetCredentialsExecute mocks base method. -func (m *MockDefaultApi) GetCredentialsExecute(ctx context.Context, projectId, region, credentialsRef string) (*loadbalancer.GetCredentialsResponse, error) { +func (m *MockDefaultAPI) GetCredentialsExecute(r v2api.ApiGetCredentialsRequest) (*v2api.GetCredentialsResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetCredentialsExecute", ctx, projectId, region, credentialsRef) - ret0, _ := ret[0].(*loadbalancer.GetCredentialsResponse) + ret := m.ctrl.Call(m, "GetCredentialsExecute", r) + ret0, _ := ret[0].(*v2api.GetCredentialsResponse) ret1, _ := ret[1].(error) return ret0, ret1 } // GetCredentialsExecute indicates an expected call of GetCredentialsExecute. -func (mr *MockDefaultApiMockRecorder) GetCredentialsExecute(ctx, projectId, region, credentialsRef any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) GetCredentialsExecute(r any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCredentialsExecute", reflect.TypeOf((*MockDefaultApi)(nil).GetCredentialsExecute), ctx, projectId, region, credentialsRef) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCredentialsExecute", reflect.TypeOf((*MockDefaultAPI)(nil).GetCredentialsExecute), r) } // GetLoadBalancer mocks base method. -func (m *MockDefaultApi) GetLoadBalancer(ctx context.Context, projectId, region, name string) loadbalancer.ApiGetLoadBalancerRequest { +func (m *MockDefaultAPI) GetLoadBalancer(ctx context.Context, projectId, region, name string) v2api.ApiGetLoadBalancerRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetLoadBalancer", ctx, projectId, region, name) - ret0, _ := ret[0].(loadbalancer.ApiGetLoadBalancerRequest) + ret0, _ := ret[0].(v2api.ApiGetLoadBalancerRequest) return ret0 } // GetLoadBalancer indicates an expected call of GetLoadBalancer. -func (mr *MockDefaultApiMockRecorder) GetLoadBalancer(ctx, projectId, region, name any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) GetLoadBalancer(ctx, projectId, region, name any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLoadBalancer", reflect.TypeOf((*MockDefaultApi)(nil).GetLoadBalancer), ctx, projectId, region, name) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLoadBalancer", reflect.TypeOf((*MockDefaultAPI)(nil).GetLoadBalancer), ctx, projectId, region, name) } // GetLoadBalancerExecute mocks base method. -func (m *MockDefaultApi) GetLoadBalancerExecute(ctx context.Context, projectId, region, name string) (*loadbalancer.LoadBalancer, error) { +func (m *MockDefaultAPI) GetLoadBalancerExecute(r v2api.ApiGetLoadBalancerRequest) (*v2api.LoadBalancer, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetLoadBalancerExecute", ctx, projectId, region, name) - ret0, _ := ret[0].(*loadbalancer.LoadBalancer) + ret := m.ctrl.Call(m, "GetLoadBalancerExecute", r) + ret0, _ := ret[0].(*v2api.LoadBalancer) ret1, _ := ret[1].(error) return ret0, ret1 } // GetLoadBalancerExecute indicates an expected call of GetLoadBalancerExecute. -func (mr *MockDefaultApiMockRecorder) GetLoadBalancerExecute(ctx, projectId, region, name any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) GetLoadBalancerExecute(r any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLoadBalancerExecute", reflect.TypeOf((*MockDefaultApi)(nil).GetLoadBalancerExecute), ctx, projectId, region, name) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLoadBalancerExecute", reflect.TypeOf((*MockDefaultAPI)(nil).GetLoadBalancerExecute), r) } // GetQuota mocks base method. -func (m *MockDefaultApi) GetQuota(ctx context.Context, projectId, region string) loadbalancer.ApiGetQuotaRequest { +func (m *MockDefaultAPI) GetQuota(ctx context.Context, projectId, region string) v2api.ApiGetQuotaRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetQuota", ctx, projectId, region) - ret0, _ := ret[0].(loadbalancer.ApiGetQuotaRequest) + ret0, _ := ret[0].(v2api.ApiGetQuotaRequest) return ret0 } // GetQuota indicates an expected call of GetQuota. -func (mr *MockDefaultApiMockRecorder) GetQuota(ctx, projectId, region any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) GetQuota(ctx, projectId, region any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQuota", reflect.TypeOf((*MockDefaultApi)(nil).GetQuota), ctx, projectId, region) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQuota", reflect.TypeOf((*MockDefaultAPI)(nil).GetQuota), ctx, projectId, region) } // GetQuotaExecute mocks base method. -func (m *MockDefaultApi) GetQuotaExecute(ctx context.Context, projectId, region string) (*loadbalancer.GetQuotaResponse, error) { +func (m *MockDefaultAPI) GetQuotaExecute(r v2api.ApiGetQuotaRequest) (*v2api.GetQuotaResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetQuotaExecute", ctx, projectId, region) - ret0, _ := ret[0].(*loadbalancer.GetQuotaResponse) + ret := m.ctrl.Call(m, "GetQuotaExecute", r) + ret0, _ := ret[0].(*v2api.GetQuotaResponse) ret1, _ := ret[1].(error) return ret0, ret1 } // GetQuotaExecute indicates an expected call of GetQuotaExecute. -func (mr *MockDefaultApiMockRecorder) GetQuotaExecute(ctx, projectId, region any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) GetQuotaExecute(r any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQuotaExecute", reflect.TypeOf((*MockDefaultApi)(nil).GetQuotaExecute), ctx, projectId, region) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQuotaExecute", reflect.TypeOf((*MockDefaultAPI)(nil).GetQuotaExecute), r) } // ListCredentials mocks base method. -func (m *MockDefaultApi) ListCredentials(ctx context.Context, projectId, region string) loadbalancer.ApiListCredentialsRequest { +func (m *MockDefaultAPI) ListCredentials(ctx context.Context, projectId, region string) v2api.ApiListCredentialsRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ListCredentials", ctx, projectId, region) - ret0, _ := ret[0].(loadbalancer.ApiListCredentialsRequest) + ret0, _ := ret[0].(v2api.ApiListCredentialsRequest) return ret0 } // ListCredentials indicates an expected call of ListCredentials. -func (mr *MockDefaultApiMockRecorder) ListCredentials(ctx, projectId, region any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) ListCredentials(ctx, projectId, region any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListCredentials", reflect.TypeOf((*MockDefaultApi)(nil).ListCredentials), ctx, projectId, region) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListCredentials", reflect.TypeOf((*MockDefaultAPI)(nil).ListCredentials), ctx, projectId, region) } // ListCredentialsExecute mocks base method. -func (m *MockDefaultApi) ListCredentialsExecute(ctx context.Context, projectId, region string) (*loadbalancer.ListCredentialsResponse, error) { +func (m *MockDefaultAPI) ListCredentialsExecute(r v2api.ApiListCredentialsRequest) (*v2api.ListCredentialsResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListCredentialsExecute", ctx, projectId, region) - ret0, _ := ret[0].(*loadbalancer.ListCredentialsResponse) + ret := m.ctrl.Call(m, "ListCredentialsExecute", r) + ret0, _ := ret[0].(*v2api.ListCredentialsResponse) ret1, _ := ret[1].(error) return ret0, ret1 } // ListCredentialsExecute indicates an expected call of ListCredentialsExecute. -func (mr *MockDefaultApiMockRecorder) ListCredentialsExecute(ctx, projectId, region any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) ListCredentialsExecute(r any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListCredentialsExecute", reflect.TypeOf((*MockDefaultApi)(nil).ListCredentialsExecute), ctx, projectId, region) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListCredentialsExecute", reflect.TypeOf((*MockDefaultAPI)(nil).ListCredentialsExecute), r) } // ListLoadBalancers mocks base method. -func (m *MockDefaultApi) ListLoadBalancers(ctx context.Context, projectId, region string) loadbalancer.ApiListLoadBalancersRequest { +func (m *MockDefaultAPI) ListLoadBalancers(ctx context.Context, projectId, region string) v2api.ApiListLoadBalancersRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ListLoadBalancers", ctx, projectId, region) - ret0, _ := ret[0].(loadbalancer.ApiListLoadBalancersRequest) + ret0, _ := ret[0].(v2api.ApiListLoadBalancersRequest) return ret0 } // ListLoadBalancers indicates an expected call of ListLoadBalancers. -func (mr *MockDefaultApiMockRecorder) ListLoadBalancers(ctx, projectId, region any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) ListLoadBalancers(ctx, projectId, region any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListLoadBalancers", reflect.TypeOf((*MockDefaultApi)(nil).ListLoadBalancers), ctx, projectId, region) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListLoadBalancers", reflect.TypeOf((*MockDefaultAPI)(nil).ListLoadBalancers), ctx, projectId, region) } // ListLoadBalancersExecute mocks base method. -func (m *MockDefaultApi) ListLoadBalancersExecute(ctx context.Context, projectId, region string) (*loadbalancer.ListLoadBalancersResponse, error) { +func (m *MockDefaultAPI) ListLoadBalancersExecute(r v2api.ApiListLoadBalancersRequest) (*v2api.ListLoadBalancersResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListLoadBalancersExecute", ctx, projectId, region) - ret0, _ := ret[0].(*loadbalancer.ListLoadBalancersResponse) + ret := m.ctrl.Call(m, "ListLoadBalancersExecute", r) + ret0, _ := ret[0].(*v2api.ListLoadBalancersResponse) ret1, _ := ret[1].(error) return ret0, ret1 } // ListLoadBalancersExecute indicates an expected call of ListLoadBalancersExecute. -func (mr *MockDefaultApiMockRecorder) ListLoadBalancersExecute(ctx, projectId, region any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) ListLoadBalancersExecute(r any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListLoadBalancersExecute", reflect.TypeOf((*MockDefaultApi)(nil).ListLoadBalancersExecute), ctx, projectId, region) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListLoadBalancersExecute", reflect.TypeOf((*MockDefaultAPI)(nil).ListLoadBalancersExecute), r) } // ListPlans mocks base method. -func (m *MockDefaultApi) ListPlans(ctx context.Context, region string) loadbalancer.ApiListPlansRequest { +func (m *MockDefaultAPI) ListPlans(ctx context.Context, region string) v2api.ApiListPlansRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ListPlans", ctx, region) - ret0, _ := ret[0].(loadbalancer.ApiListPlansRequest) + ret0, _ := ret[0].(v2api.ApiListPlansRequest) return ret0 } // ListPlans indicates an expected call of ListPlans. -func (mr *MockDefaultApiMockRecorder) ListPlans(ctx, region any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) ListPlans(ctx, region any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPlans", reflect.TypeOf((*MockDefaultApi)(nil).ListPlans), ctx, region) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPlans", reflect.TypeOf((*MockDefaultAPI)(nil).ListPlans), ctx, region) } // ListPlansExecute mocks base method. -func (m *MockDefaultApi) ListPlansExecute(ctx context.Context, region string) (*loadbalancer.ListPlansResponse, error) { +func (m *MockDefaultAPI) ListPlansExecute(r v2api.ApiListPlansRequest) (*v2api.ListPlansResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListPlansExecute", ctx, region) - ret0, _ := ret[0].(*loadbalancer.ListPlansResponse) + ret := m.ctrl.Call(m, "ListPlansExecute", r) + ret0, _ := ret[0].(*v2api.ListPlansResponse) ret1, _ := ret[1].(error) return ret0, ret1 } // ListPlansExecute indicates an expected call of ListPlansExecute. -func (mr *MockDefaultApiMockRecorder) ListPlansExecute(ctx, region any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) ListPlansExecute(r any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPlansExecute", reflect.TypeOf((*MockDefaultApi)(nil).ListPlansExecute), ctx, region) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPlansExecute", reflect.TypeOf((*MockDefaultAPI)(nil).ListPlansExecute), r) } // UpdateCredentials mocks base method. -func (m *MockDefaultApi) UpdateCredentials(ctx context.Context, projectId, region, credentialsRef string) loadbalancer.ApiUpdateCredentialsRequest { +func (m *MockDefaultAPI) UpdateCredentials(ctx context.Context, projectId, region, credentialsRef string) v2api.ApiUpdateCredentialsRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateCredentials", ctx, projectId, region, credentialsRef) - ret0, _ := ret[0].(loadbalancer.ApiUpdateCredentialsRequest) + ret0, _ := ret[0].(v2api.ApiUpdateCredentialsRequest) return ret0 } // UpdateCredentials indicates an expected call of UpdateCredentials. -func (mr *MockDefaultApiMockRecorder) UpdateCredentials(ctx, projectId, region, credentialsRef any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) UpdateCredentials(ctx, projectId, region, credentialsRef any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateCredentials", reflect.TypeOf((*MockDefaultApi)(nil).UpdateCredentials), ctx, projectId, region, credentialsRef) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateCredentials", reflect.TypeOf((*MockDefaultAPI)(nil).UpdateCredentials), ctx, projectId, region, credentialsRef) } // UpdateCredentialsExecute mocks base method. -func (m *MockDefaultApi) UpdateCredentialsExecute(ctx context.Context, projectId, region, credentialsRef string) (*loadbalancer.UpdateCredentialsResponse, error) { +func (m *MockDefaultAPI) UpdateCredentialsExecute(r v2api.ApiUpdateCredentialsRequest) (*v2api.UpdateCredentialsResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateCredentialsExecute", ctx, projectId, region, credentialsRef) - ret0, _ := ret[0].(*loadbalancer.UpdateCredentialsResponse) + ret := m.ctrl.Call(m, "UpdateCredentialsExecute", r) + ret0, _ := ret[0].(*v2api.UpdateCredentialsResponse) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateCredentialsExecute indicates an expected call of UpdateCredentialsExecute. -func (mr *MockDefaultApiMockRecorder) UpdateCredentialsExecute(ctx, projectId, region, credentialsRef any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) UpdateCredentialsExecute(r any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateCredentialsExecute", reflect.TypeOf((*MockDefaultApi)(nil).UpdateCredentialsExecute), ctx, projectId, region, credentialsRef) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateCredentialsExecute", reflect.TypeOf((*MockDefaultAPI)(nil).UpdateCredentialsExecute), r) } // UpdateLoadBalancer mocks base method. -func (m *MockDefaultApi) UpdateLoadBalancer(ctx context.Context, projectId, region, name string) loadbalancer.ApiUpdateLoadBalancerRequest { +func (m *MockDefaultAPI) UpdateLoadBalancer(ctx context.Context, projectId, region, name string) v2api.ApiUpdateLoadBalancerRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateLoadBalancer", ctx, projectId, region, name) - ret0, _ := ret[0].(loadbalancer.ApiUpdateLoadBalancerRequest) + ret0, _ := ret[0].(v2api.ApiUpdateLoadBalancerRequest) return ret0 } // UpdateLoadBalancer indicates an expected call of UpdateLoadBalancer. -func (mr *MockDefaultApiMockRecorder) UpdateLoadBalancer(ctx, projectId, region, name any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) UpdateLoadBalancer(ctx, projectId, region, name any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateLoadBalancer", reflect.TypeOf((*MockDefaultApi)(nil).UpdateLoadBalancer), ctx, projectId, region, name) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateLoadBalancer", reflect.TypeOf((*MockDefaultAPI)(nil).UpdateLoadBalancer), ctx, projectId, region, name) } // UpdateLoadBalancerExecute mocks base method. -func (m *MockDefaultApi) UpdateLoadBalancerExecute(ctx context.Context, projectId, region, name string) (*loadbalancer.LoadBalancer, error) { +func (m *MockDefaultAPI) UpdateLoadBalancerExecute(r v2api.ApiUpdateLoadBalancerRequest) (*v2api.LoadBalancer, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateLoadBalancerExecute", ctx, projectId, region, name) - ret0, _ := ret[0].(*loadbalancer.LoadBalancer) + ret := m.ctrl.Call(m, "UpdateLoadBalancerExecute", r) + ret0, _ := ret[0].(*v2api.LoadBalancer) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateLoadBalancerExecute indicates an expected call of UpdateLoadBalancerExecute. -func (mr *MockDefaultApiMockRecorder) UpdateLoadBalancerExecute(ctx, projectId, region, name any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) UpdateLoadBalancerExecute(r any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateLoadBalancerExecute", reflect.TypeOf((*MockDefaultApi)(nil).UpdateLoadBalancerExecute), ctx, projectId, region, name) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateLoadBalancerExecute", reflect.TypeOf((*MockDefaultAPI)(nil).UpdateLoadBalancerExecute), r) } // UpdateTargetPool mocks base method. -func (m *MockDefaultApi) UpdateTargetPool(ctx context.Context, projectId, region, name, targetPoolName string) loadbalancer.ApiUpdateTargetPoolRequest { +func (m *MockDefaultAPI) UpdateTargetPool(ctx context.Context, projectId, region, name, targetPoolName string) v2api.ApiUpdateTargetPoolRequest { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateTargetPool", ctx, projectId, region, name, targetPoolName) - ret0, _ := ret[0].(loadbalancer.ApiUpdateTargetPoolRequest) + ret0, _ := ret[0].(v2api.ApiUpdateTargetPoolRequest) return ret0 } // UpdateTargetPool indicates an expected call of UpdateTargetPool. -func (mr *MockDefaultApiMockRecorder) UpdateTargetPool(ctx, projectId, region, name, targetPoolName any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) UpdateTargetPool(ctx, projectId, region, name, targetPoolName any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTargetPool", reflect.TypeOf((*MockDefaultApi)(nil).UpdateTargetPool), ctx, projectId, region, name, targetPoolName) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTargetPool", reflect.TypeOf((*MockDefaultAPI)(nil).UpdateTargetPool), ctx, projectId, region, name, targetPoolName) } // UpdateTargetPoolExecute mocks base method. -func (m *MockDefaultApi) UpdateTargetPoolExecute(ctx context.Context, projectId, region, name, targetPoolName string) (*loadbalancer.TargetPool, error) { +func (m *MockDefaultAPI) UpdateTargetPoolExecute(r v2api.ApiUpdateTargetPoolRequest) (*v2api.TargetPool, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateTargetPoolExecute", ctx, projectId, region, name, targetPoolName) - ret0, _ := ret[0].(*loadbalancer.TargetPool) + ret := m.ctrl.Call(m, "UpdateTargetPoolExecute", r) + ret0, _ := ret[0].(*v2api.TargetPool) ret1, _ := ret[1].(error) return ret0, ret1 } // UpdateTargetPoolExecute indicates an expected call of UpdateTargetPoolExecute. -func (mr *MockDefaultApiMockRecorder) UpdateTargetPoolExecute(ctx, projectId, region, name, targetPoolName any) *gomock.Call { +func (mr *MockDefaultAPIMockRecorder) UpdateTargetPoolExecute(r any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTargetPoolExecute", reflect.TypeOf((*MockDefaultApi)(nil).UpdateTargetPoolExecute), ctx, projectId, region, name, targetPoolName) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateTargetPoolExecute", reflect.TypeOf((*MockDefaultAPI)(nil).UpdateTargetPoolExecute), r) } diff --git a/pkg/stackit/client.go b/pkg/stackit/client.go index f979c128..f31a7cc4 100644 --- a/pkg/stackit/client.go +++ b/pkg/stackit/client.go @@ -29,7 +29,7 @@ import ( sdkconfig "github.com/stackitcloud/stackit-sdk-go/core/config" oapiError "github.com/stackitcloud/stackit-sdk-go/core/oapierror" "github.com/stackitcloud/stackit-sdk-go/services/iaas" - "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer" + loadbalancer "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api" "gopkg.in/yaml.v3" "k8s.io/apimachinery/pkg/util/wait" @@ -110,7 +110,7 @@ type iaasClient struct { } type lbClient struct { - client loadbalancer.DefaultApi + client loadbalancer.DefaultAPI region string } @@ -190,7 +190,7 @@ func CreateIaaSClient(cfg *stackitconfig.CSIConfig) (iaas.DefaultApi, error) { return iaas.NewAPIClient(opts...) } -func NewLoadbalancerClient(cl loadbalancer.DefaultApi, region string) (LoadbalancerClient, error) { +func NewLoadbalancerClient(cl loadbalancer.DefaultAPI, region string) (LoadbalancerClient, error) { return &lbClient{ client: cl, region: region, diff --git a/pkg/stackit/loadbalancer.go b/pkg/stackit/loadbalancer.go index 9173fae2..6820c60a 100644 --- a/pkg/stackit/loadbalancer.go +++ b/pkg/stackit/loadbalancer.go @@ -4,11 +4,11 @@ import ( "context" "github.com/google/uuid" - "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer" + loadbalancer "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api" ) func (cl lbClient) GetLoadBalancer(ctx context.Context, projectID, name string) (*loadbalancer.LoadBalancer, error) { - lb, err := cl.client.GetLoadBalancerExecute(ctx, projectID, cl.region, name) + lb, err := cl.client.GetLoadBalancer(ctx, projectID, cl.region, name).Execute() if isOpenAPINotFound(err) { return lb, ErrorNotFound } @@ -17,7 +17,7 @@ func (cl lbClient) GetLoadBalancer(ctx context.Context, projectID, name string) // DeleteLoadBalancer returns no error if the load balancer doesn't exist. func (cl lbClient) DeleteLoadBalancer(ctx context.Context, projectID, name string) error { - _, err := cl.client.DeleteLoadBalancerExecute(ctx, projectID, cl.region, name) + _, err := cl.client.DeleteLoadBalancer(ctx, projectID, cl.region, name).Execute() return err } @@ -49,11 +49,11 @@ func (cl lbClient) UpdateTargetPool(ctx context.Context, projectID, name, target } func (cl lbClient) ListCredentials(ctx context.Context, projectID string) (*loadbalancer.ListCredentialsResponse, error) { - return cl.client.ListCredentialsExecute(ctx, projectID, cl.region) + return cl.client.ListCredentials(ctx, projectID, cl.region).Execute() } func (cl lbClient) GetCredentials(ctx context.Context, projectID, credentialsRef string) (*loadbalancer.GetCredentialsResponse, error) { - return cl.client.GetCredentialsExecute(ctx, projectID, cl.region, credentialsRef) + return cl.client.GetCredentials(ctx, projectID, cl.region, credentialsRef).Execute() } func (cl lbClient) CreateCredentials(ctx context.Context, projectID string, payload loadbalancer.CreateCredentialsPayload) (*loadbalancer.CreateCredentialsResponse, error) { //nolint:lll // looks weird when shortened diff --git a/pkg/stackit/loadbalancer_mock.go b/pkg/stackit/loadbalancer_mock.go index b621d725..18dbf72a 100644 --- a/pkg/stackit/loadbalancer_mock.go +++ b/pkg/stackit/loadbalancer_mock.go @@ -13,7 +13,7 @@ import ( context "context" reflect "reflect" - loadbalancer "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer" + v2api "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api" gomock "go.uber.org/mock/gomock" ) @@ -42,10 +42,10 @@ func (m *MockLoadbalancerClient) EXPECT() *MockLoadbalancerClientMockRecorder { } // CreateCredentials mocks base method. -func (m *MockLoadbalancerClient) CreateCredentials(ctx context.Context, projectID string, payload loadbalancer.CreateCredentialsPayload) (*loadbalancer.CreateCredentialsResponse, error) { +func (m *MockLoadbalancerClient) CreateCredentials(ctx context.Context, projectID string, payload v2api.CreateCredentialsPayload) (*v2api.CreateCredentialsResponse, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateCredentials", ctx, projectID, payload) - ret0, _ := ret[0].(*loadbalancer.CreateCredentialsResponse) + ret0, _ := ret[0].(*v2api.CreateCredentialsResponse) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -57,18 +57,18 @@ func (mr *MockLoadbalancerClientMockRecorder) CreateCredentials(ctx, projectID, } // CreateLoadBalancer mocks base method. -func (m *MockLoadbalancerClient) CreateLoadBalancer(ctx context.Context, projectID string, arg2 *loadbalancer.CreateLoadBalancerPayload) (*loadbalancer.LoadBalancer, error) { +func (m *MockLoadbalancerClient) CreateLoadBalancer(ctx context.Context, projectID string, loadbalancer *v2api.CreateLoadBalancerPayload) (*v2api.LoadBalancer, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateLoadBalancer", ctx, projectID, arg2) - ret0, _ := ret[0].(*loadbalancer.LoadBalancer) + ret := m.ctrl.Call(m, "CreateLoadBalancer", ctx, projectID, loadbalancer) + ret0, _ := ret[0].(*v2api.LoadBalancer) ret1, _ := ret[1].(error) return ret0, ret1 } // CreateLoadBalancer indicates an expected call of CreateLoadBalancer. -func (mr *MockLoadbalancerClientMockRecorder) CreateLoadBalancer(ctx, projectID, arg2 any) *gomock.Call { +func (mr *MockLoadbalancerClientMockRecorder) CreateLoadBalancer(ctx, projectID, loadbalancer any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateLoadBalancer", reflect.TypeOf((*MockLoadbalancerClient)(nil).CreateLoadBalancer), ctx, projectID, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateLoadBalancer", reflect.TypeOf((*MockLoadbalancerClient)(nil).CreateLoadBalancer), ctx, projectID, loadbalancer) } // DeleteCredentials mocks base method. @@ -100,10 +100,10 @@ func (mr *MockLoadbalancerClientMockRecorder) DeleteLoadBalancer(ctx, projectID, } // GetCredentials mocks base method. -func (m *MockLoadbalancerClient) GetCredentials(ctx context.Context, projectID, credentialRef string) (*loadbalancer.GetCredentialsResponse, error) { +func (m *MockLoadbalancerClient) GetCredentials(ctx context.Context, projectID, credentialRef string) (*v2api.GetCredentialsResponse, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetCredentials", ctx, projectID, credentialRef) - ret0, _ := ret[0].(*loadbalancer.GetCredentialsResponse) + ret0, _ := ret[0].(*v2api.GetCredentialsResponse) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -115,10 +115,10 @@ func (mr *MockLoadbalancerClientMockRecorder) GetCredentials(ctx, projectID, cre } // GetLoadBalancer mocks base method. -func (m *MockLoadbalancerClient) GetLoadBalancer(ctx context.Context, projectID, name string) (*loadbalancer.LoadBalancer, error) { +func (m *MockLoadbalancerClient) GetLoadBalancer(ctx context.Context, projectID, name string) (*v2api.LoadBalancer, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetLoadBalancer", ctx, projectID, name) - ret0, _ := ret[0].(*loadbalancer.LoadBalancer) + ret0, _ := ret[0].(*v2api.LoadBalancer) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -130,10 +130,10 @@ func (mr *MockLoadbalancerClientMockRecorder) GetLoadBalancer(ctx, projectID, na } // ListCredentials mocks base method. -func (m *MockLoadbalancerClient) ListCredentials(ctx context.Context, projectID string) (*loadbalancer.ListCredentialsResponse, error) { +func (m *MockLoadbalancerClient) ListCredentials(ctx context.Context, projectID string) (*v2api.ListCredentialsResponse, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ListCredentials", ctx, projectID) - ret0, _ := ret[0].(*loadbalancer.ListCredentialsResponse) + ret0, _ := ret[0].(*v2api.ListCredentialsResponse) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -145,7 +145,7 @@ func (mr *MockLoadbalancerClientMockRecorder) ListCredentials(ctx, projectID any } // UpdateCredentials mocks base method. -func (m *MockLoadbalancerClient) UpdateCredentials(ctx context.Context, projectID, credentialRef string, payload loadbalancer.UpdateCredentialsPayload) error { +func (m *MockLoadbalancerClient) UpdateCredentials(ctx context.Context, projectID, credentialRef string, payload v2api.UpdateCredentialsPayload) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateCredentials", ctx, projectID, credentialRef, payload) ret0, _ := ret[0].(error) @@ -159,10 +159,10 @@ func (mr *MockLoadbalancerClientMockRecorder) UpdateCredentials(ctx, projectID, } // UpdateLoadBalancer mocks base method. -func (m *MockLoadbalancerClient) UpdateLoadBalancer(ctx context.Context, projectID, name string, update *loadbalancer.UpdateLoadBalancerPayload) (*loadbalancer.LoadBalancer, error) { +func (m *MockLoadbalancerClient) UpdateLoadBalancer(ctx context.Context, projectID, name string, update *v2api.UpdateLoadBalancerPayload) (*v2api.LoadBalancer, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateLoadBalancer", ctx, projectID, name, update) - ret0, _ := ret[0].(*loadbalancer.LoadBalancer) + ret0, _ := ret[0].(*v2api.LoadBalancer) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -174,7 +174,7 @@ func (mr *MockLoadbalancerClientMockRecorder) UpdateLoadBalancer(ctx, projectID, } // UpdateTargetPool mocks base method. -func (m *MockLoadbalancerClient) UpdateTargetPool(ctx context.Context, projectID, name, targetPoolName string, payload loadbalancer.UpdateTargetPoolPayload) error { +func (m *MockLoadbalancerClient) UpdateTargetPool(ctx context.Context, projectID, name, targetPoolName string, payload v2api.UpdateTargetPoolPayload) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateTargetPool", ctx, projectID, name, targetPoolName, payload) ret0, _ := ret[0].(error) diff --git a/pkg/stackit/loadbalancer_test.go b/pkg/stackit/loadbalancer_test.go index 46aca1eb..96a83f91 100644 --- a/pkg/stackit/loadbalancer_test.go +++ b/pkg/stackit/loadbalancer_test.go @@ -7,7 +7,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/stackitcloud/stackit-sdk-go/core/oapierror" - "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer" + loadbalancer "github.com/stackitcloud/stackit-sdk-go/services/loadbalancer/v2api" "go.uber.org/mock/gomock" "k8s.io/utils/ptr" @@ -19,13 +19,13 @@ var _ = Describe("LBAPI Client", func() { region = "eu01" mockCtrl *gomock.Controller - mockAPI *mock.MockDefaultApi + mockAPI *mock.MockDefaultAPI lbClient LoadbalancerClient ) BeforeEach(func() { mockCtrl = gomock.NewController(GinkgoT()) - mockAPI = mock.NewMockDefaultApi(mockCtrl) + mockAPI = mock.NewMockDefaultAPI(mockCtrl) var err error lbClient, err = NewLoadbalancerClient(mockAPI, region) @@ -36,8 +36,9 @@ var _ = Describe("LBAPI Client", func() { It("should return the received load balancer instance", func() { expectedName := "test LB instance" expectedLB := &loadbalancer.LoadBalancer{Name: new(expectedName)} - mockAPI.EXPECT().GetLoadBalancerExecute(gomock.Any(), "projectID", gomock.Any(), expectedName). - Return(expectedLB, nil).Times(1) + mockAPI.EXPECT().GetLoadBalancer(gomock.Any(), "projectID", gomock.Any(), expectedName). + Return(loadbalancer.ApiGetLoadBalancerRequest{ApiService: mockAPI}).Times(1) + mockAPI.EXPECT().GetLoadBalancerExecute(gomock.Any()).Return(expectedLB, nil).Times(1) actualLB, err := lbClient.GetLoadBalancer(context.Background(), "projectID", expectedName) Expect(err).ToNot(HaveOccurred()) @@ -47,16 +48,18 @@ var _ = Describe("LBAPI Client", func() { }) It("should use the configured STACKIT region", func() { - mockAPI.EXPECT().GetLoadBalancerExecute(gomock.Any(), gomock.Any(), region, gomock.Any()). - Return(&loadbalancer.LoadBalancer{}, nil).Times(1) + mockAPI.EXPECT().GetLoadBalancer(gomock.Any(), gomock.Any(), region, gomock.Any()). + Return(loadbalancer.ApiGetLoadBalancerRequest{ApiService: mockAPI}).Times(1) + mockAPI.EXPECT().GetLoadBalancerExecute(gomock.Any()).Return(&loadbalancer.LoadBalancer{}, nil).Times(1) _, err := lbClient.GetLoadBalancer(context.Background(), "projectID", "name") Expect(err).ToNot(HaveOccurred()) }) It("should return ErrorNotFound if a GenericOpenAPIError with status 404 occurs", func() { - mockAPI.EXPECT().GetLoadBalancerExecute(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()). - Return(nil, &oapierror.GenericOpenAPIError{StatusCode: http.StatusNotFound}).Times(1) + mockAPI.EXPECT().GetLoadBalancer(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()). + Return(loadbalancer.ApiGetLoadBalancerRequest{ApiService: mockAPI}).Times(1) + mockAPI.EXPECT().GetLoadBalancerExecute(gomock.Any()).Return(nil, &oapierror.GenericOpenAPIError{StatusCode: http.StatusNotFound}).Times(1) actualLB, err := lbClient.GetLoadBalancer(context.Background(), "projectID", "name") Expect(actualLB).To(BeNil())