Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/azclient/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ generatecode: build ## Generate client
$(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v9 --package-alias armnetwork --resource PrivateLinkService --client-name PrivateLinkServicesClient --verbs get,createorupdate,delete,list --expand --ratelimitkey privateLinkServiceRateLimit
$(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v9 --package-alias armnetwork --resource IPGroup --client-name IPGroupsClient --verbs get,createorupdate,delete,listbyrg --expand --ratelimitkey ipGroupRateLimit
$(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v9 --package-alias armnetwork --resource NatGateway --client-name NatGatewaysClient --verbs get,createorupdate,delete,list --expand --ratelimitkey natGatewayRateLimit
$(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v9 --package-alias armnetwork --resource ServiceGateway --client-name ServiceGatewaysClient --verbs get,createorupdate,delete,list --ratelimitkey serviceGatewayRateLimit
$(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage --package-alias armstorage --resource Account --client-name AccountsClient --verbs listbyrg --expand --ratelimitkey storageAccountRateLimit
$(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns --package-alias armprivatedns --resource PrivateZone --client-name PrivateZonesClient --verbs get,createorupdate --ratelimitkey privateDNSRateLimit
$(TYPESCAFFOLD) --package github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns --package-alias armprivatedns --resource PrivateZone --subresource VirtualNetworkLink --client-name VirtualNetworkLinksClient --verbs get,createorupdate --ratelimitkey virtualNetworkRateLimit
Expand Down
2 changes: 2 additions & 0 deletions pkg/azclient/factory.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions pkg/azclient/factory_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions pkg/azclient/factory_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions pkg/azclient/mock_azclient/interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 104 additions & 0 deletions pkg/azclient/servicegatewayclient/custom.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
Copyright 2026 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package servicegatewayclient

import (
"context"

"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v9"

"sigs.k8s.io/cloud-provider-azure/pkg/azclient/metrics"
"sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils"
)

const UpdateTagsOperationName = "ServiceGatewaysClient.UpdateTags"

// UpdateTags updates the tags of a ServiceGateway.
func (client *Client) UpdateTags(ctx context.Context, resourceGroupName string, serviceGatewayName string, parameters armnetwork.TagsObject) (result *armnetwork.ServiceGateway, err error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems this file is not tested?

metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "ServiceGateway", "update_tags")
defer func() { metricsCtx.Observe(ctx, err) }()
ctx, endSpan := runtime.StartSpan(ctx, UpdateTagsOperationName, client.tracer, nil)
defer endSpan(err)
resp, err := client.ServiceGatewaysClient.UpdateTags(ctx, resourceGroupName, serviceGatewayName, parameters, nil)
if err != nil {
return nil, err
}
return &resp.ServiceGateway, nil
}

const GetAddressLocationsOperationName = "ServiceGatewaysClient.GetAddressLocations"

// GetAddressLocations gets the address locations of a ServiceGateway.
func (client *Client) GetAddressLocations(ctx context.Context, resourceGroupName string, serviceGatewayName string) (result []*armnetwork.ServiceGatewayAddressLocationResponse, err error) {
metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "ServiceGateway", "get_address_locations")
defer func() { metricsCtx.Observe(ctx, err) }()
ctx, endSpan := runtime.StartSpan(ctx, GetAddressLocationsOperationName, client.tracer, nil)
defer endSpan(err)
pager := client.NewGetAddressLocationsPager(resourceGroupName, serviceGatewayName, nil)
for pager.More() {
nextResult, err := pager.NextPage(ctx)
if err != nil {
return nil, err
}
result = append(result, nextResult.Value...)
}
return result, nil
}

const GetServicesOperationName = "ServiceGatewaysClient.GetServices"

// GetServices gets the services of a ServiceGateway.
func (client *Client) GetServices(ctx context.Context, resourceGroupName string, serviceGatewayName string) (result []*armnetwork.ServiceGatewayService, err error) {
metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "ServiceGateway", "get_services")
defer func() { metricsCtx.Observe(ctx, err) }()
ctx, endSpan := runtime.StartSpan(ctx, GetServicesOperationName, client.tracer, nil)
defer endSpan(err)
pager := client.NewGetServicesPager(resourceGroupName, serviceGatewayName, nil)
for pager.More() {
nextResult, err := pager.NextPage(ctx)
if err != nil {
return nil, err
}
result = append(result, nextResult.Value...)
}
return result, nil
}

const UpdateAddressLocationsOperationName = "ServiceGatewaysClient.UpdateAddressLocations"

// UpdateAddressLocations updates the address locations of a ServiceGateway.
func (client *Client) UpdateAddressLocations(ctx context.Context, resourceGroupName string, serviceGatewayName string, parameters armnetwork.ServiceGatewayUpdateAddressLocationsRequest) (err error) {
metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "ServiceGateway", "update_address_locations")
defer func() { metricsCtx.Observe(ctx, err) }()
ctx, endSpan := runtime.StartSpan(ctx, UpdateAddressLocationsOperationName, client.tracer, nil)
defer endSpan(err)
_, err = utils.NewPollerWrapper(client.BeginUpdateAddressLocations(ctx, resourceGroupName, serviceGatewayName, parameters, nil)).WaitforPollerResp(ctx)
return err
}

const UpdateServicesOperationName = "ServiceGatewaysClient.UpdateServices"

// UpdateServices updates the services of a ServiceGateway.
func (client *Client) UpdateServices(ctx context.Context, resourceGroupName string, serviceGatewayName string, parameters armnetwork.ServiceGatewayUpdateServicesRequest) (err error) {
metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "ServiceGateway", "update_services")
defer func() { metricsCtx.Observe(ctx, err) }()
ctx, endSpan := runtime.StartSpan(ctx, UpdateServicesOperationName, client.tracer, nil)
defer endSpan(err)
_, err = utils.NewPollerWrapper(client.BeginUpdateServices(ctx, resourceGroupName, serviceGatewayName, parameters, nil)).WaitforPollerResp(ctx)
return err
}
39 changes: 39 additions & 0 deletions pkg/azclient/servicegatewayclient/interface.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
Copyright 2026 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// +azure:enableclientgen:=true
package servicegatewayclient

import (
"context"

armnetwork "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v9"

"sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils"
)

// +azure:client:verbs=get;createorupdate;delete;list,resource=ServiceGateway,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v9,packageAlias=armnetwork,clientName=ServiceGatewaysClient,expand=false,rateLimitKey=serviceGatewayRateLimit
type Interface interface {
utils.GetFunc[armnetwork.ServiceGateway]
utils.CreateOrUpdateFunc[armnetwork.ServiceGateway]
utils.DeleteFunc[armnetwork.ServiceGateway]
utils.ListFunc[armnetwork.ServiceGateway]
UpdateTags(ctx context.Context, resourceGroupName string, serviceGatewayName string, parameters armnetwork.TagsObject) (*armnetwork.ServiceGateway, error)
GetAddressLocations(ctx context.Context, resourceGroupName string, serviceGatewayName string) ([]*armnetwork.ServiceGatewayAddressLocationResponse, error)
GetServices(ctx context.Context, resourceGroupName string, serviceGatewayName string) ([]*armnetwork.ServiceGatewayService, error)
UpdateAddressLocations(ctx context.Context, resourceGroupName string, serviceGatewayName string, parameters armnetwork.ServiceGatewayUpdateAddressLocationsRequest) error
UpdateServices(ctx context.Context, resourceGroupName string, serviceGatewayName string, parameters armnetwork.ServiceGatewayUpdateServicesRequest) error
Comment thread
georgeedward2000 marked this conversation as resolved.
}
25 changes: 25 additions & 0 deletions pkg/azclient/servicegatewayclient/interface_gomock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading