Skip to content

Commit

Permalink
expose get option in fileshareclient (#7982)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinForReal authored Jan 9, 2025
1 parent e4e8024 commit 9fcaf84
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 50 deletions.
16 changes: 16 additions & 0 deletions pkg/azclient/fileshareclient/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,19 @@ func (client *Client) List(ctx context.Context, resourceGroupName string, accoun
}
return result, nil
}

const GetOperationName = "FileSharesClient.Get"

// Get gets the FileShare
func (client *Client) Get(ctx context.Context, resourceGroupName string, accountName string, fileshareName string, option *armstorage.FileSharesClientGetOptions) (result *armstorage.FileShare, err error) {
metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "FileShare", "get")
defer func() { metricsCtx.Observe(ctx, err) }()
ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil)
defer endSpan(err)
resp, err := client.FileSharesClient.Get(ctx, resourceGroupName, accountName, fileshareName, option)
if err != nil {
return nil, err
}
//handle statuscode
return &resp.FileShare, nil
}
14 changes: 14 additions & 0 deletions pkg/azclient/fileshareclient/custom_test.go

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

16 changes: 0 additions & 16 deletions pkg/azclient/fileshareclient/fileshareclient_test.go

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

6 changes: 2 additions & 4 deletions pkg/azclient/fileshareclient/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ import (
"context"

armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage"

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

// +azure:client:verbs=get,resource=Account,subResource=FileShare,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage,packageAlias=armstorage,clientName=FileSharesClient,expand=true,crossSubFactory=true
// +azure:client:resource=Account,subResource=FileShare,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage,packageAlias=armstorage,clientName=FileSharesClient,expand=true,crossSubFactory=true
type Interface interface {
utils.SubResourceGetWithExpandFunc[armstorage.FileShare]
Get(ctx context.Context, resourceGroupName string, accountName string, resourceName string, option *armstorage.FileSharesClientGetOptions) (result *armstorage.FileShare, rerr error)
List(ctx context.Context, resourceGroupName string, accountName string, option *armstorage.FileSharesClientListOptions) (result []*armstorage.FileShareItem, err error)
Create(ctx context.Context, resourceGroupName string, resourceName string, parentResourceName string, resource armstorage.FileShare, expand *string) (*armstorage.FileShare, error)
Update(ctx context.Context, resourceGroupName string, resourceName string, parentResourceName string, resource armstorage.FileShare) (*armstorage.FileShare, error)
Expand Down
12 changes: 6 additions & 6 deletions pkg/azclient/fileshareclient/mock_fileshareclient/interface.go

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

24 changes: 0 additions & 24 deletions pkg/azclient/fileshareclient/zz_generated_client.go

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

0 comments on commit 9fcaf84

Please sign in to comment.