diff --git a/pkg/azclient/fileshareclient/fileshareclient_test.go b/pkg/azclient/fileshareclient/fileshareclient_test.go index f2be01cd73..e7eba7cb7d 100644 --- a/pkg/azclient/fileshareclient/fileshareclient_test.go +++ b/pkg/azclient/fileshareclient/fileshareclient_test.go @@ -40,14 +40,14 @@ var _ = ginkgo.Describe("FileSharesClient", ginkgo.Ordered, func() { ginkgo.When("get requests are raised", func() { ginkgo.It("should not return error", func(ctx context.Context) { - newResource, err := realClient.Get(ctx, resourceGroupName, accountName, resourceName) + newResource, err := realClient.Get(ctx, resourceGroupName, accountName, resourceName, nil) gomega.Expect(err).NotTo(gomega.HaveOccurred()) gomega.Expect(newResource).NotTo(gomega.BeNil()) }) }) ginkgo.When("invalid get requests are raised", func() { ginkgo.It("should return 404 error", func(ctx context.Context) { - newResource, err := realClient.Get(ctx, resourceGroupName, accountName, resourceName+"notfound") + newResource, err := realClient.Get(ctx, resourceGroupName, accountName, resourceName+"notfound", nil) gomega.Expect(err).To(gomega.HaveOccurred()) gomega.Expect(newResource).To(gomega.BeNil()) }) diff --git a/pkg/azclient/fileshareclient/interface.go b/pkg/azclient/fileshareclient/interface.go index 69a482d41a..adb559cdbf 100644 --- a/pkg/azclient/fileshareclient/interface.go +++ b/pkg/azclient/fileshareclient/interface.go @@ -25,9 +25,9 @@ import ( "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=false,crossSubFactory=true +// +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 type Interface interface { - utils.SubResourceGetFunc[armstorage.FileShare] + utils.SubResourceGetWithExpandFunc[armstorage.FileShare] 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) diff --git a/pkg/azclient/fileshareclient/mock_fileshareclient/interface.go b/pkg/azclient/fileshareclient/mock_fileshareclient/interface.go index 5818e97411..0f800c0402 100644 --- a/pkg/azclient/fileshareclient/mock_fileshareclient/interface.go +++ b/pkg/azclient/fileshareclient/mock_fileshareclient/interface.go @@ -138,18 +138,18 @@ func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, st } // Get mocks base method. -func (m *MockInterface) Get(ctx context.Context, resourceGroupName, parentResourceName, resourceName string) (*armstorage.FileShare, error) { +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, parentResourceName, resourceName string, expand *string) (*armstorage.FileShare, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, parentResourceName, resourceName) + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, parentResourceName, resourceName, expand) ret0, _ := ret[0].(*armstorage.FileShare) ret1, _ := ret[1].(error) return ret0, ret1 } // Get indicates an expected call of Get. -func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, parentResourceName, resourceName any) *MockInterfaceGetCall { +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, parentResourceName, resourceName, expand any) *MockInterfaceGetCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, parentResourceName, resourceName) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, parentResourceName, resourceName, expand) return &MockInterfaceGetCall{Call: call} } @@ -165,13 +165,13 @@ func (c *MockInterfaceGetCall) Return(result *armstorage.FileShare, rerr error) } // Do rewrite *gomock.Call.Do -func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, string) (*armstorage.FileShare, error)) *MockInterfaceGetCall { +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, string, *string) (*armstorage.FileShare, error)) *MockInterfaceGetCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, string) (*armstorage.FileShare, error)) *MockInterfaceGetCall { +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, string, *string) (*armstorage.FileShare, error)) *MockInterfaceGetCall { c.Call = c.Call.DoAndReturn(f) return c } diff --git a/pkg/azclient/fileshareclient/zz_generated_client.go b/pkg/azclient/fileshareclient/zz_generated_client.go index ea49f60a27..cea9850c61 100644 --- a/pkg/azclient/fileshareclient/zz_generated_client.go +++ b/pkg/azclient/fileshareclient/zz_generated_client.go @@ -56,13 +56,16 @@ func New(subscriptionID string, credential azcore.TokenCredential, options *arm. const GetOperationName = "FileSharesClient.Get" // Get gets the FileShare -func (client *Client) Get(ctx context.Context, resourceGroupName string, accountName string, fileshareName string) (result *armstorage.FileShare, err error) { - +func (client *Client) Get(ctx context.Context, resourceGroupName string, accountName string, fileshareName string, expand *string) (result *armstorage.FileShare, err error) { + var ops *armstorage.FileSharesClientGetOptions + if expand != nil { + ops = &armstorage.FileSharesClientGetOptions{Expand: expand} + } 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, nil) + resp, err := client.FileSharesClient.Get(ctx, resourceGroupName, accountName, fileshareName, ops) if err != nil { return nil, err }