From f1392edd00eb3930e7fa456f02ca8c9a67ea4711 Mon Sep 17 00:00:00 2001 From: ReleaseHelper Date: Sat, 5 Aug 2023 01:10:38 +0000 Subject: [PATCH 1/3] [Release] sdk/resourcemanager/storage/armstorage/1.4.0 generation from spec commit: 0baf811c3c76c87b3c127d098519bd97141222dd --- .../storage/armstorage/CHANGELOG.md | 27 +- .../storage/armstorage/accounts_client.go | 230 ++++++++-- .../accounts_client_example_test.go | 393 ++++++++++++++++-- .../storage/armstorage/autorest.md | 7 +- .../armstorage/blobcontainers_client.go | 58 +-- .../blobcontainers_client_example_test.go | 48 +-- .../blobinventorypolicies_client.go | 16 +- ...obinventorypolicies_client_example_test.go | 108 ++--- .../storage/armstorage/blobservices_client.go | 12 +- .../blobservices_client_example_test.go | 10 +- .../storage/armstorage/constants.go | 77 +++- .../armstorage/deletedaccounts_client.go | 8 +- .../deletedaccounts_client_example_test.go | 4 +- .../armstorage/encryptionscopes_client.go | 16 +- .../encryptionscopes_client_example_test.go | 32 +- .../armstorage/fake/accounts_server.go | 99 +++++ .../storage/armstorage/fileservices_client.go | 12 +- .../fileservices_client_example_test.go | 10 +- .../storage/armstorage/fileshares_client.go | 28 +- .../fileshares_client_example_test.go | 28 +- .../storage/armstorage/localusers_client.go | 24 +- .../localusers_client_example_test.go | 14 +- .../armstorage/managementpolicies_client.go | 12 +- .../managementpolicies_client_example_test.go | 20 +- .../storage/armstorage/models.go | 114 ++++- .../storage/armstorage/models_serde.go | 240 +++++++++++ .../objectreplicationpolicies_client.go | 16 +- ...replicationpolicies_client_example_test.go | 14 +- .../storage/armstorage/operations_client.go | 4 +- .../operations_client_example_test.go | 2 +- .../storage/armstorage/options.go | 13 + .../privateendpointconnections_client.go | 16 +- ...endpointconnections_client_example_test.go | 8 +- .../armstorage/privatelinkresources_client.go | 4 +- ...rivatelinkresources_client_example_test.go | 2 +- .../storage/armstorage/queue_client.go | 20 +- .../armstorage/queue_client_example_test.go | 12 +- .../armstorage/queueservices_client.go | 12 +- .../queueservices_client_example_test.go | 6 +- .../storage/armstorage/response_types.go | 12 + .../storage/armstorage/skus_client.go | 4 +- .../armstorage/skus_client_example_test.go | 2 +- .../storage/armstorage/table_client.go | 20 +- .../armstorage/table_client_example_test.go | 12 +- .../armstorage/tableservices_client.go | 12 +- .../tableservices_client_example_test.go | 6 +- .../storage/armstorage/usages_client.go | 4 +- .../armstorage/usages_client_example_test.go | 2 +- 48 files changed, 1433 insertions(+), 417 deletions(-) diff --git a/sdk/resourcemanager/storage/armstorage/CHANGELOG.md b/sdk/resourcemanager/storage/armstorage/CHANGELOG.md index e53039469877..e266fa9dbaac 100644 --- a/sdk/resourcemanager/storage/armstorage/CHANGELOG.md +++ b/sdk/resourcemanager/storage/armstorage/CHANGELOG.md @@ -1,16 +1,25 @@ # Release History -## 1.4.0-beta.2 (2023-07-19) - -### Bug Fixes - -- Fixed a potential panic in faked paged and long-running operations. - -## 1.4.0-beta.1 (2023-06-12) - +## 1.4.0 (2023-08-25) ### Features Added -- Support for test fakes and OpenTelemetry trace spans. +- New value `CorsRuleAllowedMethodsItemCONNECT`, `CorsRuleAllowedMethodsItemTRACE` added to enum type `CorsRuleAllowedMethodsItem` +- New enum type `MigrationName` with values `MigrationNameDefault` +- New enum type `MigrationStatus` with values `MigrationStatusComplete`, `MigrationStatusFailed`, `MigrationStatusInProgress`, `MigrationStatusInvalid`, `MigrationStatusSubmittedForConversion` +- New enum type `PostFailoverRedundancy` with values `PostFailoverRedundancyStandardLRS`, `PostFailoverRedundancyStandardZRS` +- New enum type `PostPlannedFailoverRedundancy` with values `PostPlannedFailoverRedundancyStandardGRS`, `PostPlannedFailoverRedundancyStandardGZRS`, `PostPlannedFailoverRedundancyStandardRAGRS`, `PostPlannedFailoverRedundancyStandardRAGZRS` +- New function `*AccountsClient.BeginCustomerInitiatedMigration(context.Context, string, string, AccountMigration, *AccountsClientBeginCustomerInitiatedMigrationOptions) (*runtime.Poller[AccountsClientCustomerInitiatedMigrationResponse], error)` +- New function `*AccountsClient.GetCustomerInitiatedMigration(context.Context, string, string, MigrationName, *AccountsClientGetCustomerInitiatedMigrationOptions) (AccountsClientGetCustomerInitiatedMigrationResponse, error)` +- New struct `AccountMigration` +- New struct `AccountMigrationProperties` +- New struct `BlobInventoryCreationTime` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `ErrorResponseAutoGenerated` +- New field `AccountMigrationInProgress`, `IsSKUConversionBlocked` in struct `AccountProperties` +- New field `CreationTime` in struct `BlobInventoryPolicyFilter` +- New field `CanPlannedFailover`, `PostFailoverRedundancy`, `PostPlannedFailoverRedundancy` in struct `GeoReplicationStats` + ## 1.3.0 (2023-03-27) ### Features Added diff --git a/sdk/resourcemanager/storage/armstorage/accounts_client.go b/sdk/resourcemanager/storage/armstorage/accounts_client.go index 9e1f4d1d34a2..d135df24e7f2 100644 --- a/sdk/resourcemanager/storage/armstorage/accounts_client.go +++ b/sdk/resourcemanager/storage/armstorage/accounts_client.go @@ -46,7 +46,7 @@ func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, // BeginAbortHierarchicalNamespaceMigration - Abort live Migration of storage account to enable Hns // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -70,7 +70,7 @@ func (client *AccountsClient) BeginAbortHierarchicalNamespaceMigration(ctx conte // AbortHierarchicalNamespaceMigration - Abort live Migration of storage account to enable Hns // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 func (client *AccountsClient) abortHierarchicalNamespaceMigration(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginAbortHierarchicalNamespaceMigrationOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.BeginAbortHierarchicalNamespaceMigration" @@ -112,7 +112,7 @@ func (client *AccountsClient) abortHierarchicalNamespaceMigrationCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -121,7 +121,7 @@ func (client *AccountsClient) abortHierarchicalNamespaceMigrationCreateRequest(c // CheckNameAvailability - Checks that the storage account name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. // - options - AccountsClientCheckNameAvailabilityOptions contains the optional parameters for the AccountsClient.CheckNameAvailability @@ -160,7 +160,7 @@ func (client *AccountsClient) checkNameAvailabilityCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, accountName); err != nil { @@ -184,7 +184,7 @@ func (client *AccountsClient) checkNameAvailabilityHandleResponse(resp *http.Res // set of properties, the request will succeed. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -209,7 +209,7 @@ func (client *AccountsClient) BeginCreate(ctx context.Context, resourceGroupName // set of properties, the request will succeed. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 func (client *AccountsClient) create(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters, options *AccountsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.BeginCreate" @@ -251,7 +251,92 @@ func (client *AccountsClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginCustomerInitiatedMigration - Account Migration request can be triggered for a storage account to change its redundancy +// level. The migration updates the non-zonal redundant storage account to a zonal redundant account or +// vice-versa in order to have better reliability and availability. Zone-redundant storage (ZRS) replicates your storage account +// synchronously across three Azure availability zones in the primary region. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - parameters - The request parameters required to perform storage account migration. +// - options - AccountsClientBeginCustomerInitiatedMigrationOptions contains the optional parameters for the AccountsClient.BeginCustomerInitiatedMigration +// method. +func (client *AccountsClient) BeginCustomerInitiatedMigration(ctx context.Context, resourceGroupName string, accountName string, parameters AccountMigration, options *AccountsClientBeginCustomerInitiatedMigrationOptions) (*runtime.Poller[AccountsClientCustomerInitiatedMigrationResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.customerInitiatedMigration(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountsClientCustomerInitiatedMigrationResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[AccountsClientCustomerInitiatedMigrationResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CustomerInitiatedMigration - Account Migration request can be triggered for a storage account to change its redundancy +// level. The migration updates the non-zonal redundant storage account to a zonal redundant account or +// vice-versa in order to have better reliability and availability. Zone-redundant storage (ZRS) replicates your storage account +// synchronously across three Azure availability zones in the primary region. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +func (client *AccountsClient) customerInitiatedMigration(ctx context.Context, resourceGroupName string, accountName string, parameters AccountMigration, options *AccountsClientBeginCustomerInitiatedMigrationOptions) (*http.Response, error) { + var err error + const operationName = "AccountsClient.BeginCustomerInitiatedMigration" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.customerInitiatedMigrationCreateRequest(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// customerInitiatedMigrationCreateRequest creates the CustomerInitiatedMigration request. +func (client *AccountsClient) customerInitiatedMigrationCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters AccountMigration, options *AccountsClientBeginCustomerInitiatedMigrationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/startAccountMigration" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -263,7 +348,7 @@ func (client *AccountsClient) createCreateRequest(ctx context.Context, resourceG // Delete - Deletes a storage account in Microsoft Azure. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -309,7 +394,7 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -325,7 +410,7 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG // 'Planned'. Learn more about the failover options here- https://learn.microsoft.com/en-us/azure/storage/common/storage-disaster-recovery-guidance // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -356,7 +441,7 @@ func (client *AccountsClient) BeginFailover(ctx context.Context, resourceGroupNa // 'Planned'. Learn more about the failover options here- https://learn.microsoft.com/en-us/azure/storage/common/storage-disaster-recovery-guidance // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 func (client *AccountsClient) failover(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginFailoverOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.BeginFailover" @@ -398,7 +483,7 @@ func (client *AccountsClient) failoverCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") if options != nil && options.FailoverType != nil { reqQP.Set("failoverType", "Planned") } @@ -406,11 +491,82 @@ func (client *AccountsClient) failoverCreateRequest(ctx context.Context, resourc return req, nil } +// GetCustomerInitiatedMigration - Gets the status of the ongoing migration for the specified storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - accountName - The name of the storage account within the specified resource group. Storage account names must be between +// 3 and 24 characters in length and use numbers and lower-case letters only. +// - migrationName - The name of the Storage Account Migration. It should always be 'default' +// - options - AccountsClientGetCustomerInitiatedMigrationOptions contains the optional parameters for the AccountsClient.GetCustomerInitiatedMigration +// method. +func (client *AccountsClient) GetCustomerInitiatedMigration(ctx context.Context, resourceGroupName string, accountName string, migrationName MigrationName, options *AccountsClientGetCustomerInitiatedMigrationOptions) (AccountsClientGetCustomerInitiatedMigrationResponse, error) { + var err error + const operationName = "AccountsClient.GetCustomerInitiatedMigration" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCustomerInitiatedMigrationCreateRequest(ctx, resourceGroupName, accountName, migrationName, options) + if err != nil { + return AccountsClientGetCustomerInitiatedMigrationResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountsClientGetCustomerInitiatedMigrationResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientGetCustomerInitiatedMigrationResponse{}, err + } + resp, err := client.getCustomerInitiatedMigrationHandleResponse(httpResp) + return resp, err +} + +// getCustomerInitiatedMigrationCreateRequest creates the GetCustomerInitiatedMigration request. +func (client *AccountsClient) getCustomerInitiatedMigrationCreateRequest(ctx context.Context, resourceGroupName string, accountName string, migrationName MigrationName, options *AccountsClientGetCustomerInitiatedMigrationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/accountMigrations/{migrationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if migrationName == "" { + return nil, errors.New("parameter migrationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{migrationName}", url.PathEscape(string(migrationName))) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getCustomerInitiatedMigrationHandleResponse handles the GetCustomerInitiatedMigration response. +func (client *AccountsClient) getCustomerInitiatedMigrationHandleResponse(resp *http.Response) (AccountsClientGetCustomerInitiatedMigrationResponse, error) { + result := AccountsClientGetCustomerInitiatedMigrationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AccountMigration); err != nil { + return AccountsClientGetCustomerInitiatedMigrationResponse{}, err + } + return result, nil +} + // GetProperties - Returns the properties for the specified storage account including but not limited to name, SKU name, location, // and account status. The ListKeys operation should be used to retrieve storage keys. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -457,7 +613,7 @@ func (client *AccountsClient) getPropertiesCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } @@ -478,7 +634,7 @@ func (client *AccountsClient) getPropertiesHandleResponse(resp *http.Response) ( // BeginHierarchicalNamespaceMigration - Live Migration of storage account to enable Hns // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -505,7 +661,7 @@ func (client *AccountsClient) BeginHierarchicalNamespaceMigration(ctx context.Co // HierarchicalNamespaceMigration - Live Migration of storage account to enable Hns // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 func (client *AccountsClient) hierarchicalNamespaceMigration(ctx context.Context, resourceGroupName string, accountName string, requestType string, options *AccountsClientBeginHierarchicalNamespaceMigrationOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.BeginHierarchicalNamespaceMigration" @@ -547,7 +703,7 @@ func (client *AccountsClient) hierarchicalNamespaceMigrationCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") reqQP.Set("requestType", requestType) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} @@ -557,7 +713,7 @@ func (client *AccountsClient) hierarchicalNamespaceMigrationCreateRequest(ctx co // NewListPager - Lists all the storage accounts available under the subscription. Note that storage keys are not returned; // use the ListKeys operation for this. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - options - AccountsClientListOptions contains the optional parameters for the AccountsClient.NewListPager method. func (client *AccountsClient) NewListPager(options *AccountsClientListOptions) *runtime.Pager[AccountsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[AccountsClientListResponse]{ @@ -601,7 +757,7 @@ func (client *AccountsClient) listCreateRequest(ctx context.Context, options *Ac return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -619,7 +775,7 @@ func (client *AccountsClient) listHandleResponse(resp *http.Response) (AccountsC // ListAccountSAS - List SAS credentials of a storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -667,7 +823,7 @@ func (client *AccountsClient) listAccountSASCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -688,7 +844,7 @@ func (client *AccountsClient) listAccountSASHandleResponse(resp *http.Response) // NewListByResourceGroupPager - Lists all the storage accounts available under the given resource group. Note that storage // keys are not returned; use the ListKeys operation for this. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - options - AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager // method. @@ -738,7 +894,7 @@ func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -756,7 +912,7 @@ func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Respo // ListKeys - Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -803,7 +959,7 @@ func (client *AccountsClient) listKeysCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", "kerb") } @@ -824,7 +980,7 @@ func (client *AccountsClient) listKeysHandleResponse(resp *http.Response) (Accou // ListServiceSAS - List service SAS credentials of a specific resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -872,7 +1028,7 @@ func (client *AccountsClient) listServiceSASCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -893,7 +1049,7 @@ func (client *AccountsClient) listServiceSASHandleResponse(resp *http.Response) // RegenerateKey - Regenerates one of the access keys or Kerberos keys for the specified storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -941,7 +1097,7 @@ func (client *AccountsClient) regenerateKeyCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, regenerateKey); err != nil { @@ -962,7 +1118,7 @@ func (client *AccountsClient) regenerateKeyHandleResponse(resp *http.Response) ( // BeginRestoreBlobRanges - Restore blobs in the specified blob ranges // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -987,7 +1143,7 @@ func (client *AccountsClient) BeginRestoreBlobRanges(ctx context.Context, resour // RestoreBlobRanges - Restore blobs in the specified blob ranges // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 func (client *AccountsClient) restoreBlobRanges(ctx context.Context, resourceGroupName string, accountName string, parameters BlobRestoreParameters, options *AccountsClientBeginRestoreBlobRangesOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.BeginRestoreBlobRanges" @@ -1029,7 +1185,7 @@ func (client *AccountsClient) restoreBlobRangesCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -1041,7 +1197,7 @@ func (client *AccountsClient) restoreBlobRangesCreateRequest(ctx context.Context // RevokeUserDelegationKeys - Revoke user delegation keys. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -1088,7 +1244,7 @@ func (client *AccountsClient) revokeUserDelegationKeysCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -1102,7 +1258,7 @@ func (client *AccountsClient) revokeUserDelegationKeysCreateRequest(ctx context. // location and name of the storage account cannot be changed after creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -1150,7 +1306,7 @@ func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/accounts_client_example_test.go b/sdk/resourcemanager/storage/armstorage/accounts_client_example_test.go index 997cdeff51b2..27ff0e672ab7 100644 --- a/sdk/resourcemanager/storage/armstorage/accounts_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/accounts_client_example_test.go @@ -20,7 +20,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountCheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountCheckNameAvailability.json func ExampleAccountsClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -46,7 +46,7 @@ func ExampleAccountsClient_CheckNameAvailability() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/NfsV3AccountCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/NfsV3AccountCreate.json func ExampleAccountsClient_BeginCreate_nfsV3AccountCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -116,7 +116,7 @@ func ExampleAccountsClient_BeginCreate_nfsV3AccountCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountCreate.json func ExampleAccountsClient_BeginCreate_storageAccountCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -275,7 +275,7 @@ func ExampleAccountsClient_BeginCreate_storageAccountCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountCreateAllowedCopyScopeToAAD.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountCreateAllowedCopyScopeToAAD.json func ExampleAccountsClient_BeginCreate_storageAccountCreateAllowedCopyScopeToAad() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -429,7 +429,7 @@ func ExampleAccountsClient_BeginCreate_storageAccountCreateAllowedCopyScopeToAad // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountCreateAllowedCopyScopeToPrivateLink.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountCreateAllowedCopyScopeToPrivateLink.json func ExampleAccountsClient_BeginCreate_storageAccountCreateAllowedCopyScopeToPrivateLink() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -583,7 +583,7 @@ func ExampleAccountsClient_BeginCreate_storageAccountCreateAllowedCopyScopeToPri // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountCreateDisallowPublicNetworkAccess.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountCreateDisallowPublicNetworkAccess.json func ExampleAccountsClient_BeginCreate_storageAccountCreateDisallowPublicNetworkAccess() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -741,7 +741,7 @@ func ExampleAccountsClient_BeginCreate_storageAccountCreateDisallowPublicNetwork // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountCreateDnsEndpointTypeToAzureDnsZone.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountCreateDnsEndpointTypeToAzureDnsZone.json func ExampleAccountsClient_BeginCreate_storageAccountCreateDnsEndpointTypeToAzureDnsZone() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -902,7 +902,7 @@ func ExampleAccountsClient_BeginCreate_storageAccountCreateDnsEndpointTypeToAzur // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountCreateDnsEndpointTypeToStandard.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountCreateDnsEndpointTypeToStandard.json func ExampleAccountsClient_BeginCreate_storageAccountCreateDnsEndpointTypeToStandard() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1063,7 +1063,7 @@ func ExampleAccountsClient_BeginCreate_storageAccountCreateDnsEndpointTypeToStan // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountCreateEnablePublicNetworkAccess.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountCreateEnablePublicNetworkAccess.json func ExampleAccountsClient_BeginCreate_storageAccountCreateEnablePublicNetworkAccess() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1221,7 +1221,7 @@ func ExampleAccountsClient_BeginCreate_storageAccountCreateEnablePublicNetworkAc // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountCreatePremiumBlockBlobStorage.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountCreatePremiumBlockBlobStorage.json func ExampleAccountsClient_BeginCreate_storageAccountCreatePremiumBlockBlobStorage() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1320,7 +1320,7 @@ func ExampleAccountsClient_BeginCreate_storageAccountCreatePremiumBlockBlobStora // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountCreateUserAssignedEncryptionIdentityWithCMK.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountCreateUserAssignedEncryptionIdentityWithCMK.json func ExampleAccountsClient_BeginCreate_storageAccountCreateUserAssignedEncryptionIdentityWithCmk() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1452,7 +1452,7 @@ func ExampleAccountsClient_BeginCreate_storageAccountCreateUserAssignedEncryptio // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.json func ExampleAccountsClient_BeginCreate_storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1586,7 +1586,7 @@ func ExampleAccountsClient_BeginCreate_storageAccountCreateUserAssignedIdentityW // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountCreateWithImmutabilityPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountCreateWithImmutabilityPolicy.json func ExampleAccountsClient_BeginCreate_storageAccountCreateWithImmutabilityPolicy() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1666,7 +1666,7 @@ func ExampleAccountsClient_BeginCreate_storageAccountCreateWithImmutabilityPolic // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountDelete.json func ExampleAccountsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1683,7 +1683,7 @@ func ExampleAccountsClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountGetAsyncSkuConversionStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountGetAsyncSkuConversionStatus.json func ExampleAccountsClient_GetProperties_storageAccountGetAsyncSkuConversionStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1724,7 +1724,7 @@ func ExampleAccountsClient_GetProperties_storageAccountGetAsyncSkuConversionStat // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountGetProperties.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountGetProperties.json func ExampleAccountsClient_GetProperties_storageAccountGetProperties() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1753,6 +1753,7 @@ func ExampleAccountsClient_GetProperties_storageAccountGetProperties() { // }, // Kind: to.Ptr(armstorage.KindStorage), // Properties: &armstorage.AccountProperties{ + // AccountMigrationInProgress: to.Ptr(false), // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-01T02:42:41.7633306Z"); return t}()), // Encryption: &armstorage.Encryption{ // KeySource: to.Ptr(armstorage.KeySourceMicrosoftStorage), @@ -1775,6 +1776,7 @@ func ExampleAccountsClient_GetProperties_storageAccountGetProperties() { // Status: to.Ptr(armstorage.GeoReplicationStatusLive), // }, // IsHnsEnabled: to.Ptr(true), + // IsSKUConversionBlocked: to.Ptr(false), // KeyCreationTime: &armstorage.KeyCreationTime{ // Key1: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-18T04:42:22.4322836Z"); return t}()), // Key2: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-18T04:42:22.4322836Z"); return t}()), @@ -1833,7 +1835,7 @@ func ExampleAccountsClient_GetProperties_storageAccountGetProperties() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountGetPropertiesCMKEnabled.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountGetPropertiesCMKEnabled.json func ExampleAccountsClient_GetProperties_storageAccountGetPropertiesCmkEnabled() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1947,7 +1949,7 @@ func ExampleAccountsClient_GetProperties_storageAccountGetPropertiesCmkEnabled() // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountGetPropertiesCMKVersionExpirationTime.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountGetPropertiesCMKVersionExpirationTime.json func ExampleAccountsClient_GetProperties_storageAccountGetPropertiesCmkVersionExpirationTime() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2062,7 +2064,235 @@ func ExampleAccountsClient_GetProperties_storageAccountGetPropertiesCmkVersionEx // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountEnableAD.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountGetPropertiesGeoReplicationStatscanFailoverFalse.json +func ExampleAccountsClient_GetProperties_storageAccountGetPropertiesGeoReplicationStatscanFailoverFalse() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorage.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAccountsClient().GetProperties(ctx, "res9407", "sto8596", &armstorage.AccountsClientGetPropertiesOptions{Expand: to.Ptr(armstorage.StorageAccountExpandGeoReplicationStats)}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Account = armstorage.Account{ + // Name: to.Ptr("sto8596"), + // Type: to.Ptr("Microsoft.Storage/storageAccounts"), + // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9407/providers/Microsoft.Storage/storageAccounts/sto8596"), + // Location: to.Ptr("eastus2(stage)"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // "key2": to.Ptr("value2"), + // }, + // Kind: to.Ptr(armstorage.KindStorage), + // Properties: &armstorage.AccountProperties{ + // AccountMigrationInProgress: to.Ptr(false), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-01T02:42:41.7633306Z"); return t}()), + // Encryption: &armstorage.Encryption{ + // KeySource: to.Ptr(armstorage.KeySourceMicrosoftStorage), + // Services: &armstorage.EncryptionServices{ + // Blob: &armstorage.EncryptionService{ + // Enabled: to.Ptr(true), + // KeyType: to.Ptr(armstorage.KeyTypeAccount), + // LastEnabledTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-11T20:49:31.7036140Z"); return t}()), + // }, + // File: &armstorage.EncryptionService{ + // Enabled: to.Ptr(true), + // KeyType: to.Ptr(armstorage.KeyTypeAccount), + // LastEnabledTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-11T20:49:31.7036140Z"); return t}()), + // }, + // }, + // }, + // GeoReplicationStats: &armstorage.GeoReplicationStats{ + // CanFailover: to.Ptr(false), + // CanPlannedFailover: to.Ptr(false), + // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-30T00:25:34Z"); return t}()), + // PostFailoverRedundancy: to.Ptr(armstorage.PostFailoverRedundancyStandardLRS), + // PostPlannedFailoverRedundancy: to.Ptr(armstorage.PostPlannedFailoverRedundancyStandardGRS), + // Status: to.Ptr(armstorage.GeoReplicationStatusLive), + // }, + // IsHnsEnabled: to.Ptr(true), + // IsSKUConversionBlocked: to.Ptr(false), + // KeyCreationTime: &armstorage.KeyCreationTime{ + // Key1: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-18T04:42:22.4322836Z"); return t}()), + // Key2: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-18T04:42:22.4322836Z"); return t}()), + // }, + // NetworkRuleSet: &armstorage.NetworkRuleSet{ + // Bypass: to.Ptr(armstorage.BypassAzureServices), + // DefaultAction: to.Ptr(armstorage.DefaultActionAllow), + // IPRules: []*armstorage.IPRule{ + // }, + // ResourceAccessRules: []*armstorage.ResourceAccessRule{ + // { + // ResourceID: to.Ptr("/subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace"), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // }}, + // VirtualNetworkRules: []*armstorage.VirtualNetworkRule{ + // }, + // }, + // PrimaryEndpoints: &armstorage.Endpoints{ + // Blob: to.Ptr("https://sto8596.blob.core.windows.net/"), + // Dfs: to.Ptr("https://sto8596.dfs.core.windows.net/"), + // File: to.Ptr("https://sto8596.file.core.windows.net/"), + // InternetEndpoints: &armstorage.AccountInternetEndpoints{ + // Blob: to.Ptr("https://sto8596-internetrouting.blob.core.windows.net/"), + // Dfs: to.Ptr("https://sto8596-internetrouting.dfs.core.windows.net/"), + // File: to.Ptr("https://sto8596-internetrouting.file.core.windows.net/"), + // Web: to.Ptr("https://sto8596-internetrouting.web.core.windows.net/"), + // }, + // MicrosoftEndpoints: &armstorage.AccountMicrosoftEndpoints{ + // Blob: to.Ptr("https://sto8596-microsoftrouting.blob.core.windows.net/"), + // Dfs: to.Ptr("https://sto8596-microsoftrouting.dfs.core.windows.net/"), + // File: to.Ptr("https://sto8596-microsoftrouting.file.core.windows.net/"), + // Queue: to.Ptr("https://sto8596-microsoftrouting.queue.core.windows.net/"), + // Table: to.Ptr("https://sto8596-microsoftrouting.table.core.windows.net/"), + // Web: to.Ptr("https://sto8596-microsoftrouting.web.core.windows.net/"), + // }, + // Queue: to.Ptr("https://sto8596.queue.core.windows.net/"), + // Table: to.Ptr("https://sto8596.table.core.windows.net/"), + // Web: to.Ptr("https://sto8596.web.core.windows.net/"), + // }, + // PrimaryLocation: to.Ptr("eastus2(stage)"), + // ProvisioningState: to.Ptr(armstorage.ProvisioningStateSucceeded), + // RoutingPreference: &armstorage.RoutingPreference{ + // PublishInternetEndpoints: to.Ptr(true), + // PublishMicrosoftEndpoints: to.Ptr(true), + // RoutingChoice: to.Ptr(armstorage.RoutingChoiceMicrosoftRouting), + // }, + // SecondaryLocation: to.Ptr("northcentralus(stage)"), + // StatusOfPrimary: to.Ptr(armstorage.AccountStatusAvailable), + // StatusOfSecondary: to.Ptr(armstorage.AccountStatusAvailable), + // EnableHTTPSTrafficOnly: to.Ptr(false), + // }, + // SKU: &armstorage.SKU{ + // Name: to.Ptr(armstorage.SKUNameStandardGRS), + // Tier: to.Ptr(armstorage.SKUTierStandard), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountGetPropertiesGeoReplicationStatscanFailoverTrue.json +func ExampleAccountsClient_GetProperties_storageAccountGetPropertiesGeoReplicationStatscanFailoverTrue() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorage.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAccountsClient().GetProperties(ctx, "res9407", "sto8596", &armstorage.AccountsClientGetPropertiesOptions{Expand: to.Ptr(armstorage.StorageAccountExpandGeoReplicationStats)}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Account = armstorage.Account{ + // Name: to.Ptr("sto8596"), + // Type: to.Ptr("Microsoft.Storage/storageAccounts"), + // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9407/providers/Microsoft.Storage/storageAccounts/sto8596"), + // Location: to.Ptr("eastus2(stage)"), + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // "key2": to.Ptr("value2"), + // }, + // Kind: to.Ptr(armstorage.KindStorage), + // Properties: &armstorage.AccountProperties{ + // AccountMigrationInProgress: to.Ptr(false), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-06-01T02:42:41.7633306Z"); return t}()), + // Encryption: &armstorage.Encryption{ + // KeySource: to.Ptr(armstorage.KeySourceMicrosoftStorage), + // Services: &armstorage.EncryptionServices{ + // Blob: &armstorage.EncryptionService{ + // Enabled: to.Ptr(true), + // KeyType: to.Ptr(armstorage.KeyTypeAccount), + // LastEnabledTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-11T20:49:31.7036140Z"); return t}()), + // }, + // File: &armstorage.EncryptionService{ + // Enabled: to.Ptr(true), + // KeyType: to.Ptr(armstorage.KeyTypeAccount), + // LastEnabledTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-11T20:49:31.7036140Z"); return t}()), + // }, + // }, + // }, + // GeoReplicationStats: &armstorage.GeoReplicationStats{ + // CanFailover: to.Ptr(true), + // CanPlannedFailover: to.Ptr(true), + // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-30T00:25:34Z"); return t}()), + // PostFailoverRedundancy: to.Ptr(armstorage.PostFailoverRedundancyStandardLRS), + // PostPlannedFailoverRedundancy: to.Ptr(armstorage.PostPlannedFailoverRedundancyStandardGRS), + // Status: to.Ptr(armstorage.GeoReplicationStatusLive), + // }, + // IsHnsEnabled: to.Ptr(true), + // IsSKUConversionBlocked: to.Ptr(false), + // KeyCreationTime: &armstorage.KeyCreationTime{ + // Key1: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-18T04:42:22.4322836Z"); return t}()), + // Key2: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-18T04:42:22.4322836Z"); return t}()), + // }, + // NetworkRuleSet: &armstorage.NetworkRuleSet{ + // Bypass: to.Ptr(armstorage.BypassAzureServices), + // DefaultAction: to.Ptr(armstorage.DefaultActionAllow), + // IPRules: []*armstorage.IPRule{ + // }, + // ResourceAccessRules: []*armstorage.ResourceAccessRule{ + // { + // ResourceID: to.Ptr("/subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace"), + // TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + // }}, + // VirtualNetworkRules: []*armstorage.VirtualNetworkRule{ + // }, + // }, + // PrimaryEndpoints: &armstorage.Endpoints{ + // Blob: to.Ptr("https://sto8596.blob.core.windows.net/"), + // Dfs: to.Ptr("https://sto8596.dfs.core.windows.net/"), + // File: to.Ptr("https://sto8596.file.core.windows.net/"), + // InternetEndpoints: &armstorage.AccountInternetEndpoints{ + // Blob: to.Ptr("https://sto8596-internetrouting.blob.core.windows.net/"), + // Dfs: to.Ptr("https://sto8596-internetrouting.dfs.core.windows.net/"), + // File: to.Ptr("https://sto8596-internetrouting.file.core.windows.net/"), + // Web: to.Ptr("https://sto8596-internetrouting.web.core.windows.net/"), + // }, + // MicrosoftEndpoints: &armstorage.AccountMicrosoftEndpoints{ + // Blob: to.Ptr("https://sto8596-microsoftrouting.blob.core.windows.net/"), + // Dfs: to.Ptr("https://sto8596-microsoftrouting.dfs.core.windows.net/"), + // File: to.Ptr("https://sto8596-microsoftrouting.file.core.windows.net/"), + // Queue: to.Ptr("https://sto8596-microsoftrouting.queue.core.windows.net/"), + // Table: to.Ptr("https://sto8596-microsoftrouting.table.core.windows.net/"), + // Web: to.Ptr("https://sto8596-microsoftrouting.web.core.windows.net/"), + // }, + // Queue: to.Ptr("https://sto8596.queue.core.windows.net/"), + // Table: to.Ptr("https://sto8596.table.core.windows.net/"), + // Web: to.Ptr("https://sto8596.web.core.windows.net/"), + // }, + // PrimaryLocation: to.Ptr("eastus2(stage)"), + // ProvisioningState: to.Ptr(armstorage.ProvisioningStateSucceeded), + // RoutingPreference: &armstorage.RoutingPreference{ + // PublishInternetEndpoints: to.Ptr(true), + // PublishMicrosoftEndpoints: to.Ptr(true), + // RoutingChoice: to.Ptr(armstorage.RoutingChoiceMicrosoftRouting), + // }, + // SecondaryLocation: to.Ptr("northcentralus(stage)"), + // StatusOfPrimary: to.Ptr(armstorage.AccountStatusAvailable), + // StatusOfSecondary: to.Ptr(armstorage.AccountStatusAvailable), + // EnableHTTPSTrafficOnly: to.Ptr(false), + // }, + // SKU: &armstorage.SKU{ + // Name: to.Ptr(armstorage.SKUNameStandardGRS), + // Tier: to.Ptr(armstorage.SKUTierStandard), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountEnableAD.json func ExampleAccountsClient_Update_storageAccountEnableAd() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2143,7 +2373,7 @@ func ExampleAccountsClient_Update_storageAccountEnableAd() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountEnableCMK.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountEnableCMK.json func ExampleAccountsClient_Update_storageAccountEnableCmk() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2243,7 +2473,7 @@ func ExampleAccountsClient_Update_storageAccountEnableCmk() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountUpdate.json func ExampleAccountsClient_Update_storageAccountUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2401,7 +2631,7 @@ func ExampleAccountsClient_Update_storageAccountUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountUpdateAllowedCopyScopeToAAD.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountUpdateAllowedCopyScopeToAAD.json func ExampleAccountsClient_Update_storageAccountUpdateAllowedCopyScopeToAad() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2556,7 +2786,7 @@ func ExampleAccountsClient_Update_storageAccountUpdateAllowedCopyScopeToAad() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountUpdateDisablePublicNetworkAccess.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountUpdateDisablePublicNetworkAccess.json func ExampleAccountsClient_Update_storageAccountUpdateDisablePublicNetworkAccess() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2711,7 +2941,7 @@ func ExampleAccountsClient_Update_storageAccountUpdateDisablePublicNetworkAccess // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountUpdateUserAssignedEncryptionIdentityWithCMK.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountUpdateUserAssignedEncryptionIdentityWithCMK.json func ExampleAccountsClient_Update_storageAccountUpdateUserAssignedEncryptionIdentityWithCmk() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2838,7 +3068,7 @@ func ExampleAccountsClient_Update_storageAccountUpdateUserAssignedEncryptionIden // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.json func ExampleAccountsClient_Update_storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -2967,7 +3197,7 @@ func ExampleAccountsClient_Update_storageAccountUpdateUserAssignedIdentityWithFe // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountUpdateWithImmutabilityPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountUpdateWithImmutabilityPolicy.json func ExampleAccountsClient_Update_storageAccountUpdateWithImmutabilityPolicy() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3023,7 +3253,7 @@ func ExampleAccountsClient_Update_storageAccountUpdateWithImmutabilityPolicy() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountList.json func ExampleAccountsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3350,7 +3580,7 @@ func ExampleAccountsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountListByResourceGroup.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountListByResourceGroup.json func ExampleAccountsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3441,7 +3671,7 @@ func ExampleAccountsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountListKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountListKeys.json func ExampleAccountsClient_ListKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3474,7 +3704,7 @@ func ExampleAccountsClient_ListKeys() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountRegenerateKerbKey.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountRegenerateKerbKey.json func ExampleAccountsClient_RegenerateKey_storageAccountRegenerateKerbKey() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3514,7 +3744,7 @@ func ExampleAccountsClient_RegenerateKey_storageAccountRegenerateKerbKey() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountRegenerateKey.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountRegenerateKey.json func ExampleAccountsClient_RegenerateKey_storageAccountRegenerateKey() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3549,7 +3779,7 @@ func ExampleAccountsClient_RegenerateKey_storageAccountRegenerateKey() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountListAccountSAS.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountListAccountSAS.json func ExampleAccountsClient_ListAccountSAS() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3580,7 +3810,7 @@ func ExampleAccountsClient_ListAccountSAS() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountListServiceSAS.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountListServiceSAS.json func ExampleAccountsClient_ListServiceSAS() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3608,7 +3838,7 @@ func ExampleAccountsClient_ListServiceSAS() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountFailover.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountFailover.json func ExampleAccountsClient_BeginFailover_storageAccountFailover() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3629,7 +3859,7 @@ func ExampleAccountsClient_BeginFailover_storageAccountFailover() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountFailoverPlanned.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountFailoverPlanned.json func ExampleAccountsClient_BeginFailover_storageAccountFailoverPlanned() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3650,7 +3880,7 @@ func ExampleAccountsClient_BeginFailover_storageAccountFailoverPlanned() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountHierarchicalNamespaceMigration.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountHierarchicalNamespaceMigration.json func ExampleAccountsClient_BeginHierarchicalNamespaceMigration() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3671,7 +3901,7 @@ func ExampleAccountsClient_BeginHierarchicalNamespaceMigration() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountAbortHierarchicalNamespaceMigration.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountAbortHierarchicalNamespaceMigration.json func ExampleAccountsClient_BeginAbortHierarchicalNamespaceMigration() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3692,7 +3922,92 @@ func ExampleAccountsClient_BeginAbortHierarchicalNamespaceMigration() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobRangesRestore.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountPostMigration.json +func ExampleAccountsClient_BeginCustomerInitiatedMigration() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorage.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAccountsClient().BeginCustomerInitiatedMigration(ctx, "resource-group-name", "accountname", armstorage.AccountMigration{ + StorageAccountMigrationDetails: &armstorage.AccountMigrationProperties{ + TargetSKUName: to.Ptr(armstorage.SKUNameStandardZRS), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountGetMigrationFailed.json +func ExampleAccountsClient_GetCustomerInitiatedMigration_storageAccountGetMigrationFailed() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorage.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAccountsClient().GetCustomerInitiatedMigration(ctx, "resource-group-name", "accountname", armstorage.MigrationNameDefault, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AccountMigration = armstorage.AccountMigration{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.Storage/storageAccounts/accountMigrations"), + // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/accountname/accountMigrations/default"), + // StorageAccountMigrationDetails: &armstorage.AccountMigrationProperties{ + // MigrationFailedDetailedReason: to.Ptr("ZRS is not supported for accounts with archive data."), + // MigrationFailedReason: to.Ptr("ZrsNotSupportedForAccountWithArchiveData"), + // MigrationStatus: to.Ptr(armstorage.MigrationStatusFailed), + // TargetSKUName: to.Ptr(armstorage.SKUNameStandardZRS), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountGetMigrationInProgress.json +func ExampleAccountsClient_GetCustomerInitiatedMigration_storageAccountGetMigrationInProgress() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armstorage.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAccountsClient().GetCustomerInitiatedMigration(ctx, "resource-group-name", "accountname", armstorage.MigrationNameDefault, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AccountMigration = armstorage.AccountMigration{ + // Name: to.Ptr("default"), + // Type: to.Ptr("Microsoft.Storage/storageAccounts/accountMigrations"), + // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/accountname/accountMigrations/default"), + // StorageAccountMigrationDetails: &armstorage.AccountMigrationProperties{ + // MigrationStatus: to.Ptr(armstorage.MigrationStatusInProgress), + // TargetSKUName: to.Ptr(armstorage.SKUNameStandardZRS), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobRangesRestore.json func ExampleAccountsClient_BeginRestoreBlobRanges() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -3743,7 +4058,7 @@ func ExampleAccountsClient_BeginRestoreBlobRanges() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountRevokeUserDelegationKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountRevokeUserDelegationKeys.json func ExampleAccountsClient_RevokeUserDelegationKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/autorest.md b/sdk/resourcemanager/storage/armstorage/autorest.md index 697c87873bdc..997629954ac8 100644 --- a/sdk/resourcemanager/storage/armstorage/autorest.md +++ b/sdk/resourcemanager/storage/armstorage/autorest.md @@ -5,14 +5,15 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION module: github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage -module-version: 1.4.0-beta.2 +module-version: 1.4.0 azcore-version: 1.8.0-beta.1 generate-fakes: true inject-spans: true modelerfour: seal-single-value-enum-by-default: true +tag: package-2023-01 ``` diff --git a/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go b/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go index 42a0a4fa6f06..baf54356a13b 100644 --- a/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go +++ b/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go @@ -47,7 +47,7 @@ func NewBlobContainersClient(subscriptionID string, credential azcore.TokenCrede // clears out only the specified tags in the request. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -103,7 +103,7 @@ func (client *BlobContainersClient) clearLegalHoldCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, legalHold); err != nil { @@ -126,7 +126,7 @@ func (client *BlobContainersClient) clearLegalHoldHandleResponse(resp *http.Resp // contained by the container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -181,7 +181,7 @@ func (client *BlobContainersClient) createCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, blobContainer); err != nil { @@ -203,7 +203,7 @@ func (client *BlobContainersClient) createHandleResponse(resp *http.Response) (B // but not required for this operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -259,7 +259,7 @@ func (client *BlobContainersClient) createOrUpdateImmutabilityPolicyCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -289,7 +289,7 @@ func (client *BlobContainersClient) createOrUpdateImmutabilityPolicyHandleRespon // Delete - Deletes specified container under its account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -342,7 +342,7 @@ func (client *BlobContainersClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -353,7 +353,7 @@ func (client *BlobContainersClient) deleteCreateRequest(ctx context.Context, res // container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -412,7 +412,7 @@ func (client *BlobContainersClient) deleteImmutabilityPolicyCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -435,7 +435,7 @@ func (client *BlobContainersClient) deleteImmutabilityPolicyHandleResponse(resp // allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -493,7 +493,7 @@ func (client *BlobContainersClient) extendImmutabilityPolicyCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -521,7 +521,7 @@ func (client *BlobContainersClient) extendImmutabilityPolicyHandleResponse(resp // Get - Gets properties of a specified container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -575,7 +575,7 @@ func (client *BlobContainersClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -594,7 +594,7 @@ func (client *BlobContainersClient) getHandleResponse(resp *http.Response) (Blob // body. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -650,7 +650,7 @@ func (client *BlobContainersClient) getImmutabilityPolicyCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -675,7 +675,7 @@ func (client *BlobContainersClient) getImmutabilityPolicyHandleResponse(resp *ht // can be 15 to 60 seconds, or can be infinite. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -729,7 +729,7 @@ func (client *BlobContainersClient) leaseCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Parameters != nil { @@ -753,7 +753,7 @@ func (client *BlobContainersClient) leaseHandleResponse(resp *http.Response) (Bl // NewListPager - Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation // token. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -808,7 +808,7 @@ func (client *BlobContainersClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") if options != nil && options.Maxpagesize != nil { reqQP.Set("$maxpagesize", *options.Maxpagesize) } @@ -836,7 +836,7 @@ func (client *BlobContainersClient) listHandleResponse(resp *http.Response) (Blo // action. ETag in If-Match is required for this operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -894,7 +894,7 @@ func (client *BlobContainersClient) lockImmutabilityPolicyCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -918,7 +918,7 @@ func (client *BlobContainersClient) lockImmutabilityPolicyHandleResponse(resp *h // unlocked state, Account level versioning must be enabled and there should be no Legal hold on the container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -947,7 +947,7 @@ func (client *BlobContainersClient) BeginObjectLevelWorm(ctx context.Context, re // unlocked state, Account level versioning must be enabled and there should be no Legal hold on the container. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 func (client *BlobContainersClient) objectLevelWorm(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientBeginObjectLevelWormOptions) (*http.Response, error) { var err error const operationName = "BlobContainersClient.BeginObjectLevelWorm" @@ -993,7 +993,7 @@ func (client *BlobContainersClient) objectLevelWormCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1003,7 +1003,7 @@ func (client *BlobContainersClient) objectLevelWormCreateRequest(ctx context.Con // pattern and does not clear out the existing tags that are not specified in the request. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -1059,7 +1059,7 @@ func (client *BlobContainersClient) setLegalHoldCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, legalHold); err != nil { @@ -1081,7 +1081,7 @@ func (client *BlobContainersClient) setLegalHoldHandleResponse(resp *http.Respon // Update fails if the specified container doesn't already exist. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -1136,7 +1136,7 @@ func (client *BlobContainersClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, blobContainer); err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/blobcontainers_client_example_test.go b/sdk/resourcemanager/storage/armstorage/blobcontainers_client_example_test.go index f0e4fcc2a087..5f5d9fecf267 100644 --- a/sdk/resourcemanager/storage/armstorage/blobcontainers_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/blobcontainers_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersList.json func ExampleBlobContainersClient_NewListPager_listContainers() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,7 +77,7 @@ func ExampleBlobContainersClient_NewListPager_listContainers() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/DeletedBlobContainersList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/DeletedBlobContainersList.json func ExampleBlobContainersClient_NewListPager_listDeletedContainers() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -140,7 +140,7 @@ func ExampleBlobContainersClient_NewListPager_listDeletedContainers() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersPutDefaultEncryptionScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersPutDefaultEncryptionScope.json func ExampleBlobContainersClient_Create_putContainerWithDefaultEncryptionScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -174,7 +174,7 @@ func ExampleBlobContainersClient_Create_putContainerWithDefaultEncryptionScope() // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersPutObjectLevelWorm.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersPutObjectLevelWorm.json func ExampleBlobContainersClient_Create_putContainerWithObjectLevelWorm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -210,7 +210,7 @@ func ExampleBlobContainersClient_Create_putContainerWithObjectLevelWorm() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersPut.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersPut.json func ExampleBlobContainersClient_Create_putContainers() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -235,7 +235,7 @@ func ExampleBlobContainersClient_Create_putContainers() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersPatch.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersPatch.json func ExampleBlobContainersClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -275,7 +275,7 @@ func ExampleBlobContainersClient_Update() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersGetWithAllowProtectedAppendWritesAll.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersGetWithAllowProtectedAppendWritesAll.json func ExampleBlobContainersClient_Get_getBlobContainersGetWithAllowProtectedAppendWritesAll() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -368,7 +368,7 @@ func ExampleBlobContainersClient_Get_getBlobContainersGetWithAllowProtectedAppen // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersGet.json func ExampleBlobContainersClient_Get_getContainers() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -453,7 +453,7 @@ func ExampleBlobContainersClient_Get_getContainers() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersDelete.json func ExampleBlobContainersClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -470,7 +470,7 @@ func ExampleBlobContainersClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersSetLegalHold.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersSetLegalHold.json func ExampleBlobContainersClient_SetLegalHold_setLegalHoldContainers() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -502,7 +502,7 @@ func ExampleBlobContainersClient_SetLegalHold_setLegalHoldContainers() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersSetLegalHoldAllowProtectedAppendWritesAll.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersSetLegalHoldAllowProtectedAppendWritesAll.json func ExampleBlobContainersClient_SetLegalHold_setLegalHoldContainersWithAllowProtectedAppendWritesAll() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -536,7 +536,7 @@ func ExampleBlobContainersClient_SetLegalHold_setLegalHoldContainersWithAllowPro // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersClearLegalHold.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersClearLegalHold.json func ExampleBlobContainersClient_ClearLegalHold() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -566,7 +566,7 @@ func ExampleBlobContainersClient_ClearLegalHold() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersPutImmutabilityPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersPutImmutabilityPolicy.json func ExampleBlobContainersClient_CreateOrUpdateImmutabilityPolicy_createOrUpdateImmutabilityPolicy() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -604,7 +604,7 @@ func ExampleBlobContainersClient_CreateOrUpdateImmutabilityPolicy_createOrUpdate // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersPutImmutabilityPolicyAllowProtectedAppendWritesAll.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersPutImmutabilityPolicyAllowProtectedAppendWritesAll.json func ExampleBlobContainersClient_CreateOrUpdateImmutabilityPolicy_createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -642,7 +642,7 @@ func ExampleBlobContainersClient_CreateOrUpdateImmutabilityPolicy_createOrUpdate // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersGetImmutabilityPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersGetImmutabilityPolicy.json func ExampleBlobContainersClient_GetImmutabilityPolicy() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -673,7 +673,7 @@ func ExampleBlobContainersClient_GetImmutabilityPolicy() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersDeleteImmutabilityPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersDeleteImmutabilityPolicy.json func ExampleBlobContainersClient_DeleteImmutabilityPolicy() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -684,7 +684,7 @@ func ExampleBlobContainersClient_DeleteImmutabilityPolicy() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewBlobContainersClient().DeleteImmutabilityPolicy(ctx, "res1581", "sto9621", "container4910", "\"8d59f81a7fa7be0\"", nil) + res, err := clientFactory.NewBlobContainersClient().DeleteImmutabilityPolicy(ctx, "res1581", "sto9621", "container4910", "8d59f81a7fa7be0", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -703,7 +703,7 @@ func ExampleBlobContainersClient_DeleteImmutabilityPolicy() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersLockImmutabilityPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersLockImmutabilityPolicy.json func ExampleBlobContainersClient_LockImmutabilityPolicy() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -714,7 +714,7 @@ func ExampleBlobContainersClient_LockImmutabilityPolicy() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewBlobContainersClient().LockImmutabilityPolicy(ctx, "res2702", "sto5009", "container1631", "\"8d59f825b721dd3\"", nil) + res, err := clientFactory.NewBlobContainersClient().LockImmutabilityPolicy(ctx, "res2702", "sto5009", "container1631", "8d59f825b721dd3", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -733,7 +733,7 @@ func ExampleBlobContainersClient_LockImmutabilityPolicy() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersExtendImmutabilityPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersExtendImmutabilityPolicy.json func ExampleBlobContainersClient_ExtendImmutabilityPolicy() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -744,7 +744,7 @@ func ExampleBlobContainersClient_ExtendImmutabilityPolicy() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewBlobContainersClient().ExtendImmutabilityPolicy(ctx, "res6238", "sto232", "container5023", "\"8d59f830d0c3bf9\"", &armstorage.BlobContainersClientExtendImmutabilityPolicyOptions{Parameters: &armstorage.ImmutabilityPolicy{ + res, err := clientFactory.NewBlobContainersClient().ExtendImmutabilityPolicy(ctx, "res6238", "sto232", "container5023", "8d59f830d0c3bf9", &armstorage.BlobContainersClientExtendImmutabilityPolicyOptions{Parameters: &armstorage.ImmutabilityPolicy{ Properties: &armstorage.ImmutabilityPolicyProperty{ ImmutabilityPeriodSinceCreationInDays: to.Ptr[int32](100), }, @@ -768,7 +768,7 @@ func ExampleBlobContainersClient_ExtendImmutabilityPolicy() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersLease_Acquire.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersLease_Acquire.json func ExampleBlobContainersClient_Lease_acquireALeaseOnAContainer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -795,7 +795,7 @@ func ExampleBlobContainersClient_Lease_acquireALeaseOnAContainer() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobContainersLease_Break.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobContainersLease_Break.json func ExampleBlobContainersClient_Lease_breakALeaseOnAContainer() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -822,7 +822,7 @@ func ExampleBlobContainersClient_Lease_breakALeaseOnAContainer() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/ObjectLevelWormContainerMigration.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/ObjectLevelWormContainerMigration.json func ExampleBlobContainersClient_BeginObjectLevelWorm() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go b/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go index a6eae10fd1b7..661016d958bb 100644 --- a/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go +++ b/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go @@ -46,7 +46,7 @@ func NewBlobInventoryPoliciesClient(subscriptionID string, credential azcore.Tok // CreateOrUpdate - Sets the blob inventory policy to the specified storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -100,7 +100,7 @@ func (client *BlobInventoryPoliciesClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { @@ -121,7 +121,7 @@ func (client *BlobInventoryPoliciesClient) createOrUpdateHandleResponse(resp *ht // Delete - Deletes the blob inventory policy associated with the specified storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -173,7 +173,7 @@ func (client *BlobInventoryPoliciesClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +182,7 @@ func (client *BlobInventoryPoliciesClient) deleteCreateRequest(ctx context.Conte // Get - Gets the blob inventory policy associated with the specified storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -235,7 +235,7 @@ func (client *BlobInventoryPoliciesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,7 +252,7 @@ func (client *BlobInventoryPoliciesClient) getHandleResponse(resp *http.Response // NewListPager - Gets the blob inventory policy associated with the specified storage account. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -302,7 +302,7 @@ func (client *BlobInventoryPoliciesClient) listCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client_example_test.go b/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client_example_test.go index 46c03973fb8a..4232d0eea68e 100644 --- a/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountGetBlobInventoryPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountGetBlobInventoryPolicy.json func ExampleBlobInventoryPoliciesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -85,7 +85,7 @@ func ExampleBlobInventoryPoliciesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountSetBlobInventoryPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountSetBlobInventoryPolicy.json func ExampleBlobInventoryPoliciesClient_CreateOrUpdate_storageAccountSetBlobInventoryPolicy() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -111,9 +111,9 @@ func ExampleBlobInventoryPoliciesClient_CreateOrUpdate_storageAccountSetBlobInve to.Ptr("blockBlob"), to.Ptr("appendBlob"), to.Ptr("pageBlob")}, - ExcludePrefix: []*string{ - to.Ptr("excludeprefix1"), - to.Ptr("excludeprefix2")}, + CreationTime: &armstorage.BlobInventoryCreationTime{ + LastNDays: to.Ptr[int32](1000), + }, IncludeBlobVersions: to.Ptr(true), IncludeSnapshots: to.Ptr(true), PrefixMatch: []*string{ @@ -187,60 +187,60 @@ func ExampleBlobInventoryPoliciesClient_CreateOrUpdate_storageAccountSetBlobInve // to.Ptr("blockBlob"), // to.Ptr("appendBlob"), // to.Ptr("pageBlob")}, - // ExcludePrefix: []*string{ - // to.Ptr("excludeprefix1"), - // to.Ptr("excludeprefix2")}, - // IncludeBlobVersions: to.Ptr(true), - // IncludeSnapshots: to.Ptr(true), - // PrefixMatch: []*string{ - // to.Ptr("inventoryprefix1"), - // to.Ptr("inventoryprefix2")}, - // }, - // ObjectType: to.Ptr(armstorage.ObjectTypeBlob), - // Schedule: to.Ptr(armstorage.ScheduleDaily), + // CreationTime: &armstorage.BlobInventoryCreationTime{ + // LastNDays: to.Ptr[int32](1000), + // }, + // IncludeBlobVersions: to.Ptr(true), + // IncludeSnapshots: to.Ptr(true), + // PrefixMatch: []*string{ + // to.Ptr("inventoryprefix1"), + // to.Ptr("inventoryprefix2")}, + // }, + // ObjectType: to.Ptr(armstorage.ObjectTypeBlob), + // Schedule: to.Ptr(armstorage.ScheduleDaily), + // SchemaFields: []*string{ + // to.Ptr("Name"), + // to.Ptr("Creation-Time"), + // to.Ptr("Last-Modified"), + // to.Ptr("Content-Length"), + // to.Ptr("Content-MD5"), + // to.Ptr("BlobType"), + // to.Ptr("AccessTier"), + // to.Ptr("AccessTierChangeTime"), + // to.Ptr("Snapshot"), + // to.Ptr("VersionId"), + // to.Ptr("IsCurrentVersion"), + // to.Ptr("Metadata")}, + // }, + // Destination: to.Ptr("container1"), + // Enabled: to.Ptr(true), + // }, + // { + // Name: to.Ptr("inventoryPolicyRule2"), + // Definition: &armstorage.BlobInventoryPolicyDefinition{ + // Format: to.Ptr(armstorage.FormatParquet), + // ObjectType: to.Ptr(armstorage.ObjectTypeContainer), + // Schedule: to.Ptr(armstorage.ScheduleWeekly), // SchemaFields: []*string{ // to.Ptr("Name"), - // to.Ptr("Creation-Time"), // to.Ptr("Last-Modified"), - // to.Ptr("Content-Length"), - // to.Ptr("Content-MD5"), - // to.Ptr("BlobType"), - // to.Ptr("AccessTier"), - // to.Ptr("AccessTierChangeTime"), - // to.Ptr("Snapshot"), - // to.Ptr("VersionId"), - // to.Ptr("IsCurrentVersion"), - // to.Ptr("Metadata")}, + // to.Ptr("Metadata"), + // to.Ptr("LeaseStatus"), + // to.Ptr("LeaseState"), + // to.Ptr("LeaseDuration"), + // to.Ptr("PublicAccess"), + // to.Ptr("HasImmutabilityPolicy"), + // to.Ptr("HasLegalHold")}, // }, - // Destination: to.Ptr("container1"), + // Destination: to.Ptr("container2"), // Enabled: to.Ptr(true), - // }, - // { - // Name: to.Ptr("inventoryPolicyRule2"), - // Definition: &armstorage.BlobInventoryPolicyDefinition{ - // Format: to.Ptr(armstorage.FormatParquet), - // ObjectType: to.Ptr(armstorage.ObjectTypeContainer), - // Schedule: to.Ptr(armstorage.ScheduleWeekly), - // SchemaFields: []*string{ - // to.Ptr("Name"), - // to.Ptr("Last-Modified"), - // to.Ptr("Metadata"), - // to.Ptr("LeaseStatus"), - // to.Ptr("LeaseState"), - // to.Ptr("LeaseDuration"), - // to.Ptr("PublicAccess"), - // to.Ptr("HasImmutabilityPolicy"), - // to.Ptr("HasLegalHold")}, - // }, - // Destination: to.Ptr("container2"), - // Enabled: to.Ptr(true), - // }}, - // }, + // }}, // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountSetBlobInventoryPolicyIncludeDeleteAndNewSchemaForHnsAccount.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountSetBlobInventoryPolicyIncludeDeleteAndNewSchemaForHnsAccount.json func ExampleBlobInventoryPoliciesClient_CreateOrUpdate_storageAccountSetBlobInventoryPolicyIncludeDeleteAndNewSchemaForHnsAccount() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -430,7 +430,7 @@ func ExampleBlobInventoryPoliciesClient_CreateOrUpdate_storageAccountSetBlobInve // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountSetBlobInventoryPolicyIncludeDeleteAndNewSchemaForNonHnsAccount.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountSetBlobInventoryPolicyIncludeDeleteAndNewSchemaForNonHnsAccount.json func ExampleBlobInventoryPoliciesClient_CreateOrUpdate_storageAccountSetBlobInventoryPolicyIncludeDeleteAndNewSchemaForNonHnsAccount() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -618,7 +618,7 @@ func ExampleBlobInventoryPoliciesClient_CreateOrUpdate_storageAccountSetBlobInve // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountDeleteBlobInventoryPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountDeleteBlobInventoryPolicy.json func ExampleBlobInventoryPoliciesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -635,7 +635,7 @@ func ExampleBlobInventoryPoliciesClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountListBlobInventoryPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountListBlobInventoryPolicy.json func ExampleBlobInventoryPoliciesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/blobservices_client.go b/sdk/resourcemanager/storage/armstorage/blobservices_client.go index 924ca2af2908..2ebfd3a604a4 100644 --- a/sdk/resourcemanager/storage/armstorage/blobservices_client.go +++ b/sdk/resourcemanager/storage/armstorage/blobservices_client.go @@ -47,7 +47,7 @@ func NewBlobServicesClient(subscriptionID string, credential azcore.TokenCredent // and CORS (Cross-Origin Resource Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -96,7 +96,7 @@ func (client *BlobServicesClient) getServicePropertiesCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -113,7 +113,7 @@ func (client *BlobServicesClient) getServicePropertiesHandleResponse(resp *http. // NewListPager - List blob services of storage account. It returns a collection of one object named default. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -162,7 +162,7 @@ func (client *BlobServicesClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,7 +181,7 @@ func (client *BlobServicesClient) listHandleResponse(resp *http.Response) (BlobS // and CORS (Cross-Origin Resource Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -232,7 +232,7 @@ func (client *BlobServicesClient) setServicePropertiesCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/blobservices_client_example_test.go b/sdk/resourcemanager/storage/armstorage/blobservices_client_example_test.go index dbc3548cf2d5..4c64a98f7468 100644 --- a/sdk/resourcemanager/storage/armstorage/blobservices_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/blobservices_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobServicesList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobServicesList.json func ExampleBlobServicesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -115,7 +115,7 @@ func ExampleBlobServicesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobServicesPutAllowPermanentDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobServicesPutAllowPermanentDelete.json func ExampleBlobServicesClient_SetServiceProperties_blobServicesPutAllowPermanentDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -157,7 +157,7 @@ func ExampleBlobServicesClient_SetServiceProperties_blobServicesPutAllowPermanen // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobServicesPutLastAccessTimeBasedTracking.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobServicesPutLastAccessTimeBasedTracking.json func ExampleBlobServicesClient_SetServiceProperties_blobServicesPutLastAccessTimeBasedTracking() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -201,7 +201,7 @@ func ExampleBlobServicesClient_SetServiceProperties_blobServicesPutLastAccessTim // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobServicesPut.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobServicesPut.json func ExampleBlobServicesClient_SetServiceProperties_putBlobServices() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -351,7 +351,7 @@ func ExampleBlobServicesClient_SetServiceProperties_putBlobServices() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/BlobServicesGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/BlobServicesGet.json func ExampleBlobServicesClient_GetServiceProperties() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/constants.go b/sdk/resourcemanager/storage/armstorage/constants.go index ce050b713d33..d453dd923462 100644 --- a/sdk/resourcemanager/storage/armstorage/constants.go +++ b/sdk/resourcemanager/storage/armstorage/constants.go @@ -10,7 +10,7 @@ package armstorage const ( moduleName = "armstorage" - moduleVersion = "v1.4.0-beta.2" + moduleVersion = "v1.4.0" ) // AccessTier - Required for storage accounts where kind = BlobStorage. The access tier is used for billing. The 'Premium' @@ -161,6 +161,7 @@ func PossibleBypassValues() []Bypass { type CorsRuleAllowedMethodsItem string const ( + CorsRuleAllowedMethodsItemCONNECT CorsRuleAllowedMethodsItem = "CONNECT" CorsRuleAllowedMethodsItemDELETE CorsRuleAllowedMethodsItem = "DELETE" CorsRuleAllowedMethodsItemGET CorsRuleAllowedMethodsItem = "GET" CorsRuleAllowedMethodsItemHEAD CorsRuleAllowedMethodsItem = "HEAD" @@ -169,11 +170,13 @@ const ( CorsRuleAllowedMethodsItemPATCH CorsRuleAllowedMethodsItem = "PATCH" CorsRuleAllowedMethodsItemPOST CorsRuleAllowedMethodsItem = "POST" CorsRuleAllowedMethodsItemPUT CorsRuleAllowedMethodsItem = "PUT" + CorsRuleAllowedMethodsItemTRACE CorsRuleAllowedMethodsItem = "TRACE" ) // PossibleCorsRuleAllowedMethodsItemValues returns the possible values for the CorsRuleAllowedMethodsItem const type. func PossibleCorsRuleAllowedMethodsItemValues() []CorsRuleAllowedMethodsItem { return []CorsRuleAllowedMethodsItem{ + CorsRuleAllowedMethodsItemCONNECT, CorsRuleAllowedMethodsItemDELETE, CorsRuleAllowedMethodsItemGET, CorsRuleAllowedMethodsItemHEAD, @@ -182,6 +185,7 @@ func PossibleCorsRuleAllowedMethodsItemValues() []CorsRuleAllowedMethodsItem { CorsRuleAllowedMethodsItemPATCH, CorsRuleAllowedMethodsItemPOST, CorsRuleAllowedMethodsItemPUT, + CorsRuleAllowedMethodsItemTRACE, } } @@ -706,6 +710,19 @@ func PossibleManagementPolicyNameValues() []ManagementPolicyName { } } +type MigrationName string + +const ( + MigrationNameDefault MigrationName = "default" +) + +// PossibleMigrationNameValues returns the possible values for the MigrationName const type. +func PossibleMigrationNameValues() []MigrationName { + return []MigrationName{ + MigrationNameDefault, + } +} + // MigrationState - This property denotes the container level immutability to object level immutability migration state. type MigrationState string @@ -722,6 +739,28 @@ func PossibleMigrationStateValues() []MigrationState { } } +// MigrationStatus - Current status of migration +type MigrationStatus string + +const ( + MigrationStatusComplete MigrationStatus = "Complete" + MigrationStatusFailed MigrationStatus = "Failed" + MigrationStatusInProgress MigrationStatus = "InProgress" + MigrationStatusInvalid MigrationStatus = "Invalid" + MigrationStatusSubmittedForConversion MigrationStatus = "SubmittedForConversion" +) + +// PossibleMigrationStatusValues returns the possible values for the MigrationStatus const type. +func PossibleMigrationStatusValues() []MigrationStatus { + return []MigrationStatus{ + MigrationStatusComplete, + MigrationStatusFailed, + MigrationStatusInProgress, + MigrationStatusInvalid, + MigrationStatusSubmittedForConversion, + } +} + // MinimumTLSVersion - Set the minimum TLS version to be permitted on requests to storage. The default interpretation is TLS // 1.0 for this property. type MinimumTLSVersion string @@ -801,6 +840,42 @@ func PossiblePermissionsValues() []Permissions { } } +// PostFailoverRedundancy - The redundancy type of the account after an account failover is performed. +type PostFailoverRedundancy string + +const ( + PostFailoverRedundancyStandardLRS PostFailoverRedundancy = "Standard_LRS" + PostFailoverRedundancyStandardZRS PostFailoverRedundancy = "Standard_ZRS" +) + +// PossiblePostFailoverRedundancyValues returns the possible values for the PostFailoverRedundancy const type. +func PossiblePostFailoverRedundancyValues() []PostFailoverRedundancy { + return []PostFailoverRedundancy{ + PostFailoverRedundancyStandardLRS, + PostFailoverRedundancyStandardZRS, + } +} + +// PostPlannedFailoverRedundancy - The redundancy type of the account after a planned account failover is performed. +type PostPlannedFailoverRedundancy string + +const ( + PostPlannedFailoverRedundancyStandardGRS PostPlannedFailoverRedundancy = "Standard_GRS" + PostPlannedFailoverRedundancyStandardGZRS PostPlannedFailoverRedundancy = "Standard_GZRS" + PostPlannedFailoverRedundancyStandardRAGRS PostPlannedFailoverRedundancy = "Standard_RAGRS" + PostPlannedFailoverRedundancyStandardRAGZRS PostPlannedFailoverRedundancy = "Standard_RAGZRS" +) + +// PossiblePostPlannedFailoverRedundancyValues returns the possible values for the PostPlannedFailoverRedundancy const type. +func PossiblePostPlannedFailoverRedundancyValues() []PostPlannedFailoverRedundancy { + return []PostPlannedFailoverRedundancy{ + PostPlannedFailoverRedundancyStandardGRS, + PostPlannedFailoverRedundancyStandardGZRS, + PostPlannedFailoverRedundancyStandardRAGRS, + PostPlannedFailoverRedundancyStandardRAGZRS, + } +} + // PrivateEndpointConnectionProvisioningState - The current provisioning state. type PrivateEndpointConnectionProvisioningState string diff --git a/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go b/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go index 83878e23039c..ac1f44ed9fa0 100644 --- a/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go +++ b/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go @@ -46,7 +46,7 @@ func NewDeletedAccountsClient(subscriptionID string, credential azcore.TokenCred // Get - Get properties of specified deleted account resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - deletedAccountName - Name of the deleted storage account. // - location - The location of the deleted storage account. // - options - DeletedAccountsClientGetOptions contains the optional parameters for the DeletedAccountsClient.Get method. @@ -92,7 +92,7 @@ func (client *DeletedAccountsClient) getCreateRequest(ctx context.Context, delet return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +109,7 @@ func (client *DeletedAccountsClient) getHandleResponse(resp *http.Response) (Del // NewListPager - Lists deleted accounts under the subscription. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - options - DeletedAccountsClientListOptions contains the optional parameters for the DeletedAccountsClient.NewListPager // method. func (client *DeletedAccountsClient) NewListPager(options *DeletedAccountsClientListOptions) *runtime.Pager[DeletedAccountsClientListResponse] { @@ -154,7 +154,7 @@ func (client *DeletedAccountsClient) listCreateRequest(ctx context.Context, opti return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storage/armstorage/deletedaccounts_client_example_test.go b/sdk/resourcemanager/storage/armstorage/deletedaccounts_client_example_test.go index aff50b3a90ff..bc4c87b2123a 100644 --- a/sdk/resourcemanager/storage/armstorage/deletedaccounts_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/deletedaccounts_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/DeletedAccountList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/DeletedAccountList.json func ExampleDeletedAccountsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -69,7 +69,7 @@ func ExampleDeletedAccountsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/DeletedAccountGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/DeletedAccountGet.json func ExampleDeletedAccountsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go b/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go index d8c17bd3d700..5f0f914c3458 100644 --- a/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go +++ b/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go @@ -47,7 +47,7 @@ func NewEncryptionScopesClient(subscriptionID string, credential azcore.TokenCre // Get - Returns the properties for the specified encryption scope. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -101,7 +101,7 @@ func (client *EncryptionScopesClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -118,7 +118,7 @@ func (client *EncryptionScopesClient) getHandleResponse(resp *http.Response) (En // NewListPager - Lists all the encryption scopes available under the specified storage account. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -174,7 +174,7 @@ func (client *EncryptionScopesClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") if options != nil && options.Maxpagesize != nil { reqQP.Set("$maxpagesize", strconv.FormatInt(int64(*options.Maxpagesize), 10)) } @@ -202,7 +202,7 @@ func (client *EncryptionScopesClient) listHandleResponse(resp *http.Response) (E // does not already exist. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -257,7 +257,7 @@ func (client *EncryptionScopesClient) patchCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, encryptionScope); err != nil { @@ -280,7 +280,7 @@ func (client *EncryptionScopesClient) patchHandleResponse(resp *http.Response) ( // encryption scope properties will be updated per the specified request. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -335,7 +335,7 @@ func (client *EncryptionScopesClient) putCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, encryptionScope); err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/encryptionscopes_client_example_test.go b/sdk/resourcemanager/storage/armstorage/encryptionscopes_client_example_test.go index 9d0954d9ffd1..9582153757e3 100644 --- a/sdk/resourcemanager/storage/armstorage/encryptionscopes_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/encryptionscopes_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountPutEncryptionScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountPutEncryptionScope.json func ExampleEncryptionScopesClient_Put_storageAccountPutEncryptionScope() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -29,7 +29,7 @@ func ExampleEncryptionScopesClient_Put_storageAccountPutEncryptionScope() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEncryptionScopesClient().Put(ctx, "resource-group-name", "{storage-account-name}", "{encryption-scope-name}", armstorage.EncryptionScope{}, nil) + res, err := clientFactory.NewEncryptionScopesClient().Put(ctx, "resource-group-name", "accountname", "{encryption-scope-name}", armstorage.EncryptionScope{}, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -39,7 +39,7 @@ func ExampleEncryptionScopesClient_Put_storageAccountPutEncryptionScope() { // res.EncryptionScope = armstorage.EncryptionScope{ // Name: to.Ptr("{encryption-scope-name}"), // Type: to.Ptr("Microsoft.Storage/storageAccounts/encryptionScopes"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/{storage-account-name}/encryptionScopes/{encryption-scope-name}"), + // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/accountname/encryptionScopes/{encryption-scope-name}"), // EncryptionScopeProperties: &armstorage.EncryptionScopeProperties{ // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-16T02:42:41.7633306Z"); return t}()), // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-16T02:42:41.7633306Z"); return t}()), @@ -49,7 +49,7 @@ func ExampleEncryptionScopesClient_Put_storageAccountPutEncryptionScope() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountPutEncryptionScopeWithInfrastructureEncryption.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountPutEncryptionScopeWithInfrastructureEncryption.json func ExampleEncryptionScopesClient_Put_storageAccountPutEncryptionScopeWithInfrastructureEncryption() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -60,7 +60,7 @@ func ExampleEncryptionScopesClient_Put_storageAccountPutEncryptionScopeWithInfra if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEncryptionScopesClient().Put(ctx, "resource-group-name", "{storage-account-name}", "{encryption-scope-name}", armstorage.EncryptionScope{ + res, err := clientFactory.NewEncryptionScopesClient().Put(ctx, "resource-group-name", "accountname", "{encryption-scope-name}", armstorage.EncryptionScope{ EncryptionScopeProperties: &armstorage.EncryptionScopeProperties{ RequireInfrastructureEncryption: to.Ptr(true), }, @@ -74,7 +74,7 @@ func ExampleEncryptionScopesClient_Put_storageAccountPutEncryptionScopeWithInfra // res.EncryptionScope = armstorage.EncryptionScope{ // Name: to.Ptr("{encryption-scope-name}"), // Type: to.Ptr("Microsoft.Storage/storageAccounts/encryptionScopes"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/{storage-account-name}/encryptionScopes/{encryption-scope-name}"), + // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/accountname/encryptionScopes/{encryption-scope-name}"), // EncryptionScopeProperties: &armstorage.EncryptionScopeProperties{ // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-16T02:42:41.7633306Z"); return t}()), // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-16T02:42:41.7633306Z"); return t}()), @@ -85,7 +85,7 @@ func ExampleEncryptionScopesClient_Put_storageAccountPutEncryptionScopeWithInfra // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountPatchEncryptionScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountPatchEncryptionScope.json func ExampleEncryptionScopesClient_Patch() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -96,7 +96,7 @@ func ExampleEncryptionScopesClient_Patch() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEncryptionScopesClient().Patch(ctx, "resource-group-name", "{storage-account-name}", "{encryption-scope-name}", armstorage.EncryptionScope{ + res, err := clientFactory.NewEncryptionScopesClient().Patch(ctx, "resource-group-name", "accountname", "{encryption-scope-name}", armstorage.EncryptionScope{ EncryptionScopeProperties: &armstorage.EncryptionScopeProperties{ KeyVaultProperties: &armstorage.EncryptionScopeKeyVaultProperties{ KeyURI: to.Ptr("https://testvault.vault.core.windows.net/keys/key1/863425f1358359c"), @@ -113,7 +113,7 @@ func ExampleEncryptionScopesClient_Patch() { // res.EncryptionScope = armstorage.EncryptionScope{ // Name: to.Ptr("{encryption-scope-name}"), // Type: to.Ptr("Microsoft.Storage/storageAccounts/encryptionScopes"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/{storage-account-name}/encryptionScopes/{encryption-scope-name}"), + // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/accountname/encryptionScopes/{encryption-scope-name}"), // EncryptionScopeProperties: &armstorage.EncryptionScopeProperties{ // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-16T02:42:41.7633306Z"); return t}()), // KeyVaultProperties: &armstorage.EncryptionScopeKeyVaultProperties{ @@ -128,7 +128,7 @@ func ExampleEncryptionScopesClient_Patch() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountGetEncryptionScope.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountGetEncryptionScope.json func ExampleEncryptionScopesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -139,7 +139,7 @@ func ExampleEncryptionScopesClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEncryptionScopesClient().Get(ctx, "resource-group-name", "{storage-account-name}", "{encryption-scope-name}", nil) + res, err := clientFactory.NewEncryptionScopesClient().Get(ctx, "resource-group-name", "accountname", "{encryption-scope-name}", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -149,7 +149,7 @@ func ExampleEncryptionScopesClient_Get() { // res.EncryptionScope = armstorage.EncryptionScope{ // Name: to.Ptr("{encyrption-scope-name}"), // Type: to.Ptr("Microsoft.Storage/storageAccounts/encryptionScopes"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/{storage-account-name}/encryptionScopes/{encryption-scope-name}"), + // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/accountname/encryptionScopes/{encryption-scope-name}"), // EncryptionScopeProperties: &armstorage.EncryptionScopeProperties{ // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-16T02:42:41.7633306Z"); return t}()), // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-16T02:42:41.7633306Z"); return t}()), @@ -159,7 +159,7 @@ func ExampleEncryptionScopesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountEncryptionScopeList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountEncryptionScopeList.json func ExampleEncryptionScopesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -170,7 +170,7 @@ func ExampleEncryptionScopesClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewEncryptionScopesClient().NewListPager("resource-group-name", "{storage-account-name}", &armstorage.EncryptionScopesClientListOptions{Maxpagesize: nil, + pager := clientFactory.NewEncryptionScopesClient().NewListPager("resource-group-name", "accountname", &armstorage.EncryptionScopesClientListOptions{Maxpagesize: nil, Filter: nil, Include: nil, }) @@ -189,7 +189,7 @@ func ExampleEncryptionScopesClient_NewListPager() { // { // Name: to.Ptr("scope-1"), // Type: to.Ptr("Microsoft.Storage/storageAccounts/encryptionScopes"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/{storage-account-name}/encryptionScopes/scope-1"), + // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/accountname/encryptionScopes/scope-1"), // EncryptionScopeProperties: &armstorage.EncryptionScopeProperties{ // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-16T02:42:41.7633306Z"); return t}()), // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-16T02:42:41.7633306Z"); return t}()), @@ -200,7 +200,7 @@ func ExampleEncryptionScopesClient_NewListPager() { // { // Name: to.Ptr("scope-2"), // Type: to.Ptr("Microsoft.Storage/storageAccounts/encryptionScopes"), - // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/{storage-account-name}/encryptionScopes/scope-2"), + // ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/accountname/encryptionScopes/scope-2"), // EncryptionScopeProperties: &armstorage.EncryptionScopeProperties{ // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-10-16T04:32:14.3355306Z"); return t}()), // KeyVaultProperties: &armstorage.EncryptionScopeKeyVaultProperties{ diff --git a/sdk/resourcemanager/storage/armstorage/fake/accounts_server.go b/sdk/resourcemanager/storage/armstorage/fake/accounts_server.go index def2e7d56d5d..e4b5a7aca30a 100644 --- a/sdk/resourcemanager/storage/armstorage/fake/accounts_server.go +++ b/sdk/resourcemanager/storage/armstorage/fake/accounts_server.go @@ -36,6 +36,10 @@ type AccountsServer struct { // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginCreate func(ctx context.Context, resourceGroupName string, accountName string, parameters armstorage.AccountCreateParameters, options *armstorage.AccountsClientBeginCreateOptions) (resp azfake.PollerResponder[armstorage.AccountsClientCreateResponse], errResp azfake.ErrorResponder) + // BeginCustomerInitiatedMigration is the fake for method AccountsClient.BeginCustomerInitiatedMigration + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginCustomerInitiatedMigration func(ctx context.Context, resourceGroupName string, accountName string, parameters armstorage.AccountMigration, options *armstorage.AccountsClientBeginCustomerInitiatedMigrationOptions) (resp azfake.PollerResponder[armstorage.AccountsClientCustomerInitiatedMigrationResponse], errResp azfake.ErrorResponder) + // Delete is the fake for method AccountsClient.Delete // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent Delete func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.AccountsClientDeleteOptions) (resp azfake.Responder[armstorage.AccountsClientDeleteResponse], errResp azfake.ErrorResponder) @@ -44,6 +48,10 @@ type AccountsServer struct { // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginFailover func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.AccountsClientBeginFailoverOptions) (resp azfake.PollerResponder[armstorage.AccountsClientFailoverResponse], errResp azfake.ErrorResponder) + // GetCustomerInitiatedMigration is the fake for method AccountsClient.GetCustomerInitiatedMigration + // HTTP status codes to indicate success: http.StatusOK + GetCustomerInitiatedMigration func(ctx context.Context, resourceGroupName string, accountName string, migrationName armstorage.MigrationName, options *armstorage.AccountsClientGetCustomerInitiatedMigrationOptions) (resp azfake.Responder[armstorage.AccountsClientGetCustomerInitiatedMigrationResponse], errResp azfake.ErrorResponder) + // GetProperties is the fake for method AccountsClient.GetProperties // HTTP status codes to indicate success: http.StatusOK GetProperties func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.AccountsClientGetPropertiesOptions) (resp azfake.Responder[armstorage.AccountsClientGetPropertiesResponse], errResp azfake.ErrorResponder) @@ -97,6 +105,7 @@ func NewAccountsServerTransport(srv *AccountsServer) *AccountsServerTransport { srv: srv, beginAbortHierarchicalNamespaceMigration: newTracker[azfake.PollerResponder[armstorage.AccountsClientAbortHierarchicalNamespaceMigrationResponse]](), beginCreate: newTracker[azfake.PollerResponder[armstorage.AccountsClientCreateResponse]](), + beginCustomerInitiatedMigration: newTracker[azfake.PollerResponder[armstorage.AccountsClientCustomerInitiatedMigrationResponse]](), beginFailover: newTracker[azfake.PollerResponder[armstorage.AccountsClientFailoverResponse]](), beginHierarchicalNamespaceMigration: newTracker[azfake.PollerResponder[armstorage.AccountsClientHierarchicalNamespaceMigrationResponse]](), newListPager: newTracker[azfake.PagerResponder[armstorage.AccountsClientListResponse]](), @@ -111,6 +120,7 @@ type AccountsServerTransport struct { srv *AccountsServer beginAbortHierarchicalNamespaceMigration *tracker[azfake.PollerResponder[armstorage.AccountsClientAbortHierarchicalNamespaceMigrationResponse]] beginCreate *tracker[azfake.PollerResponder[armstorage.AccountsClientCreateResponse]] + beginCustomerInitiatedMigration *tracker[azfake.PollerResponder[armstorage.AccountsClientCustomerInitiatedMigrationResponse]] beginFailover *tracker[azfake.PollerResponder[armstorage.AccountsClientFailoverResponse]] beginHierarchicalNamespaceMigration *tracker[azfake.PollerResponder[armstorage.AccountsClientHierarchicalNamespaceMigrationResponse]] newListPager *tracker[azfake.PagerResponder[armstorage.AccountsClientListResponse]] @@ -136,10 +146,14 @@ func (a *AccountsServerTransport) Do(req *http.Request) (*http.Response, error) resp, err = a.dispatchCheckNameAvailability(req) case "AccountsClient.BeginCreate": resp, err = a.dispatchBeginCreate(req) + case "AccountsClient.BeginCustomerInitiatedMigration": + resp, err = a.dispatchBeginCustomerInitiatedMigration(req) case "AccountsClient.Delete": resp, err = a.dispatchDelete(req) case "AccountsClient.BeginFailover": resp, err = a.dispatchBeginFailover(req) + case "AccountsClient.GetCustomerInitiatedMigration": + resp, err = a.dispatchGetCustomerInitiatedMigration(req) case "AccountsClient.GetProperties": resp, err = a.dispatchGetProperties(req) case "AccountsClient.BeginHierarchicalNamespaceMigration": @@ -294,6 +308,54 @@ func (a *AccountsServerTransport) dispatchBeginCreate(req *http.Request) (*http. return resp, nil } +func (a *AccountsServerTransport) dispatchBeginCustomerInitiatedMigration(req *http.Request) (*http.Response, error) { + if a.srv.BeginCustomerInitiatedMigration == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCustomerInitiatedMigration not implemented")} + } + beginCustomerInitiatedMigration := a.beginCustomerInitiatedMigration.get(req) + if beginCustomerInitiatedMigration == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/startAccountMigration` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armstorage.AccountMigration](req) + if err != nil { + return nil, err + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCustomerInitiatedMigration(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCustomerInitiatedMigration = &respr + a.beginCustomerInitiatedMigration.add(req, beginCustomerInitiatedMigration) + } + + resp, err := server.PollerResponderNext(beginCustomerInitiatedMigration, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + a.beginCustomerInitiatedMigration.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCustomerInitiatedMigration) { + a.beginCustomerInitiatedMigration.remove(req) + } + + return resp, nil +} + func (a *AccountsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { if a.srv.Delete == nil { return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} @@ -383,6 +445,43 @@ func (a *AccountsServerTransport) dispatchBeginFailover(req *http.Request) (*htt return resp, nil } +func (a *AccountsServerTransport) dispatchGetCustomerInitiatedMigration(req *http.Request) (*http.Response, error) { + if a.srv.GetCustomerInitiatedMigration == nil { + return nil, &nonRetriableError{errors.New("fake for method GetCustomerInitiatedMigration not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/accountMigrations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + migrationNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("migrationName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.GetCustomerInitiatedMigration(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, armstorage.MigrationName(migrationNameUnescaped), nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AccountMigration, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (a *AccountsServerTransport) dispatchGetProperties(req *http.Request) (*http.Response, error) { if a.srv.GetProperties == nil { return nil, &nonRetriableError{errors.New("fake for method GetProperties not implemented")} diff --git a/sdk/resourcemanager/storage/armstorage/fileservices_client.go b/sdk/resourcemanager/storage/armstorage/fileservices_client.go index 5b7c478f339c..1dcc7cf320b1 100644 --- a/sdk/resourcemanager/storage/armstorage/fileservices_client.go +++ b/sdk/resourcemanager/storage/armstorage/fileservices_client.go @@ -47,7 +47,7 @@ func NewFileServicesClient(subscriptionID string, credential azcore.TokenCredent // Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -96,7 +96,7 @@ func (client *FileServicesClient) getServicePropertiesCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,7 +114,7 @@ func (client *FileServicesClient) getServicePropertiesHandleResponse(resp *http. // List - List all file services in storage accounts // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -161,7 +161,7 @@ func (client *FileServicesClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +180,7 @@ func (client *FileServicesClient) listHandleResponse(resp *http.Response) (FileS // Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -230,7 +230,7 @@ func (client *FileServicesClient) setServicePropertiesCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/fileservices_client_example_test.go b/sdk/resourcemanager/storage/armstorage/fileservices_client_example_test.go index 915d18a8219e..ddcbf8e740b0 100644 --- a/sdk/resourcemanager/storage/armstorage/fileservices_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/fileservices_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileServicesList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileServicesList.json func ExampleFileServicesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -100,7 +100,7 @@ func ExampleFileServicesClient_List() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileServicesPut.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileServicesPut.json func ExampleFileServicesClient_SetServiceProperties_putFileServices() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -230,7 +230,7 @@ func ExampleFileServicesClient_SetServiceProperties_putFileServices() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileServicesPut_EnableSMBMultichannel.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileServicesPut_EnableSMBMultichannel.json func ExampleFileServicesClient_SetServiceProperties_putFileServicesEnableSmbMultichannel() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -278,7 +278,7 @@ func ExampleFileServicesClient_SetServiceProperties_putFileServicesEnableSmbMult // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileServicesPut_EnableSecureSmbFeatures.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileServicesPut_EnableSecureSmbFeatures.json func ExampleFileServicesClient_SetServiceProperties_putFileServicesEnableSecureSmbFeatures() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -328,7 +328,7 @@ func ExampleFileServicesClient_SetServiceProperties_putFileServicesEnableSecureS // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileServicesGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileServicesGet.json func ExampleFileServicesClient_GetServiceProperties() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/fileshares_client.go b/sdk/resourcemanager/storage/armstorage/fileshares_client.go index a0f568c50f73..b44e5c2bc024 100644 --- a/sdk/resourcemanager/storage/armstorage/fileshares_client.go +++ b/sdk/resourcemanager/storage/armstorage/fileshares_client.go @@ -48,7 +48,7 @@ func NewFileSharesClient(subscriptionID string, credential azcore.TokenCredentia // the share. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -106,7 +106,7 @@ func (client *FileSharesClient) createCreateRequest(ctx context.Context, resourc if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, fileShare); err != nil { @@ -127,7 +127,7 @@ func (client *FileSharesClient) createHandleResponse(resp *http.Response) (FileS // Delete - Deletes specified share under its account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -180,7 +180,7 @@ func (client *FileSharesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") if options != nil && options.Include != nil { reqQP.Set("$include", *options.Include) } @@ -195,7 +195,7 @@ func (client *FileSharesClient) deleteCreateRequest(ctx context.Context, resourc // Get - Gets properties of a specified share. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -249,7 +249,7 @@ func (client *FileSharesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -274,7 +274,7 @@ func (client *FileSharesClient) getHandleResponse(resp *http.Response) (FileShar // be 15 to 60 seconds, or can be infinite. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -328,7 +328,7 @@ func (client *FileSharesClient) leaseCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.XMSSnapshot != nil { req.Raw().Header["x-ms-snapshot"] = []string{*options.XMSSnapshot} @@ -357,7 +357,7 @@ func (client *FileSharesClient) leaseHandleResponse(resp *http.Response) (FileSh // NewListPager - Lists all shares. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -412,7 +412,7 @@ func (client *FileSharesClient) listCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") if options != nil && options.Maxpagesize != nil { reqQP.Set("$maxpagesize", *options.Maxpagesize) } @@ -439,7 +439,7 @@ func (client *FileSharesClient) listHandleResponse(resp *http.Response) (FileSha // Restore - Restore a file share within a valid retention days if share soft delete is enabled // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -492,7 +492,7 @@ func (client *FileSharesClient) restoreCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, deletedShare); err != nil { @@ -505,7 +505,7 @@ func (client *FileSharesClient) restoreCreateRequest(ctx context.Context, resour // Update fails if the specified share does not already exist. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -560,7 +560,7 @@ func (client *FileSharesClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, fileShare); err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/fileshares_client_example_test.go b/sdk/resourcemanager/storage/armstorage/fileshares_client_example_test.go index 59a84b10cfc4..806adfbb667b 100644 --- a/sdk/resourcemanager/storage/armstorage/fileshares_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/fileshares_client_example_test.go @@ -20,7 +20,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/DeletedFileSharesList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/DeletedFileSharesList.json func ExampleFileSharesClient_NewListPager_listDeletedShares() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -75,7 +75,7 @@ func ExampleFileSharesClient_NewListPager_listDeletedShares() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileShareSnapshotsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileShareSnapshotsList.json func ExampleFileSharesClient_NewListPager_listShareSnapshots() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -127,7 +127,7 @@ func ExampleFileSharesClient_NewListPager_listShareSnapshots() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileSharesList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileSharesList.json func ExampleFileSharesClient_NewListPager_listShares() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -178,7 +178,7 @@ func ExampleFileSharesClient_NewListPager_listShares() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileSharesPut_NFS.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileSharesPut_NFS.json func ExampleFileSharesClient_Create_createNfsShares() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -210,7 +210,7 @@ func ExampleFileSharesClient_Create_createNfsShares() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileSharesPut.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileSharesPut.json func ExampleFileSharesClient_Create_putShares() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -235,7 +235,7 @@ func ExampleFileSharesClient_Create_putShares() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileSharesPut_AccessTier.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileSharesPut_AccessTier.json func ExampleFileSharesClient_Create_putSharesWithAccessTier() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -267,7 +267,7 @@ func ExampleFileSharesClient_Create_putSharesWithAccessTier() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileShareAclsPatch.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileShareAclsPatch.json func ExampleFileSharesClient_Update_updateShareAcls() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -315,7 +315,7 @@ func ExampleFileSharesClient_Update_updateShareAcls() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileSharesPatch.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileSharesPatch.json func ExampleFileSharesClient_Update_updateShares() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -351,7 +351,7 @@ func ExampleFileSharesClient_Update_updateShares() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileSharesGet_Stats.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileSharesGet_Stats.json func ExampleFileSharesClient_Get_getShareStats() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -384,7 +384,7 @@ func ExampleFileSharesClient_Get_getShareStats() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileSharesGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileSharesGet.json func ExampleFileSharesClient_Get_getShares() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -416,7 +416,7 @@ func ExampleFileSharesClient_Get_getShares() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileSharesDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileSharesDelete.json func ExampleFileSharesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -435,7 +435,7 @@ func ExampleFileSharesClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileSharesRestore.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileSharesRestore.json func ExampleFileSharesClient_Restore() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -455,7 +455,7 @@ func ExampleFileSharesClient_Restore() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileSharesLease_Acquire.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileSharesLease_Acquire.json func ExampleFileSharesClient_Lease_acquireALeaseOnAShare() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -483,7 +483,7 @@ func ExampleFileSharesClient_Lease_acquireALeaseOnAShare() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/FileSharesLease_Break.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/FileSharesLease_Break.json func ExampleFileSharesClient_Lease_breakALeaseOnAShare() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/localusers_client.go b/sdk/resourcemanager/storage/armstorage/localusers_client.go index a89d9b42b134..b383525adffc 100644 --- a/sdk/resourcemanager/storage/armstorage/localusers_client.go +++ b/sdk/resourcemanager/storage/armstorage/localusers_client.go @@ -46,7 +46,7 @@ func NewLocalUsersClient(subscriptionID string, credential azcore.TokenCredentia // CreateOrUpdate - Create or update the properties of a local user associated with the storage account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -101,7 +101,7 @@ func (client *LocalUsersClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { @@ -122,7 +122,7 @@ func (client *LocalUsersClient) createOrUpdateHandleResponse(resp *http.Response // Delete - Deletes the local user associated with the specified storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -174,7 +174,7 @@ func (client *LocalUsersClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -183,7 +183,7 @@ func (client *LocalUsersClient) deleteCreateRequest(ctx context.Context, resourc // Get - Get the local user of the storage account by username. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -236,7 +236,7 @@ func (client *LocalUsersClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,7 +253,7 @@ func (client *LocalUsersClient) getHandleResponse(resp *http.Response) (LocalUse // NewListPager - List the local users associated with the storage account. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -302,7 +302,7 @@ func (client *LocalUsersClient) listCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -320,7 +320,7 @@ func (client *LocalUsersClient) listHandleResponse(resp *http.Response) (LocalUs // ListKeys - List SSH authorized keys and shared key of the local user. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -373,7 +373,7 @@ func (client *LocalUsersClient) listKeysCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -391,7 +391,7 @@ func (client *LocalUsersClient) listKeysHandleResponse(resp *http.Response) (Loc // RegeneratePassword - Regenerate the local user SSH password. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -445,7 +445,7 @@ func (client *LocalUsersClient) regeneratePasswordCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storage/armstorage/localusers_client_example_test.go b/sdk/resourcemanager/storage/armstorage/localusers_client_example_test.go index 99e572eff66e..4df2f5fe822e 100644 --- a/sdk/resourcemanager/storage/armstorage/localusers_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/localusers_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/LocalUsersList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/LocalUsersList.json func ExampleLocalUsersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -86,7 +86,7 @@ func ExampleLocalUsersClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/LocalUserGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/LocalUserGet.json func ExampleLocalUsersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -129,7 +129,7 @@ func ExampleLocalUsersClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/LocalUserCreate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/LocalUserCreate.json func ExampleLocalUsersClient_CreateOrUpdate_createLocalUser() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -195,7 +195,7 @@ func ExampleLocalUsersClient_CreateOrUpdate_createLocalUser() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/LocalUserUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/LocalUserUpdate.json func ExampleLocalUsersClient_CreateOrUpdate_updateLocalUser() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -234,7 +234,7 @@ func ExampleLocalUsersClient_CreateOrUpdate_updateLocalUser() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/LocalUserDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/LocalUserDelete.json func ExampleLocalUsersClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -251,7 +251,7 @@ func ExampleLocalUsersClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/LocalUserListKeys.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/LocalUserListKeys.json func ExampleLocalUsersClient_ListKeys() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -279,7 +279,7 @@ func ExampleLocalUsersClient_ListKeys() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/LocalUserRegeneratePassword.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/LocalUserRegeneratePassword.json func ExampleLocalUsersClient_RegeneratePassword() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go b/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go index e91b7ca98707..2c743f68d9fa 100644 --- a/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go +++ b/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go @@ -46,7 +46,7 @@ func NewManagementPoliciesClient(subscriptionID string, credential azcore.TokenC // CreateOrUpdate - Sets the managementpolicy to the specified storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -100,7 +100,7 @@ func (client *ManagementPoliciesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { @@ -121,7 +121,7 @@ func (client *ManagementPoliciesClient) createOrUpdateHandleResponse(resp *http. // Delete - Deletes the managementpolicy associated with the specified storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -173,7 +173,7 @@ func (client *ManagementPoliciesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -181,7 +181,7 @@ func (client *ManagementPoliciesClient) deleteCreateRequest(ctx context.Context, // Get - Gets the managementpolicy associated with the specified storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -233,7 +233,7 @@ func (client *ManagementPoliciesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storage/armstorage/managementpolicies_client_example_test.go b/sdk/resourcemanager/storage/armstorage/managementpolicies_client_example_test.go index 76ca4e86a800..9bc4d30d8852 100644 --- a/sdk/resourcemanager/storage/armstorage/managementpolicies_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/managementpolicies_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountGetManagementPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountGetManagementPolicy.json func ExampleManagementPoliciesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -80,7 +80,7 @@ func ExampleManagementPoliciesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountSetManagementPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountSetManagementPolicy.json func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementPolicies() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -253,7 +253,7 @@ func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementP // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountSetManagementPolicyColdTierActions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountSetManagementPolicyColdTierActions.json func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementPolicyColdTierActions() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -380,7 +380,7 @@ func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementP // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountSetManagementPolicyForBlockAndAppendBlobs.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountSetManagementPolicyForBlockAndAppendBlobs.json func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementPolicyForBlockAndAppendBlobs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -479,7 +479,7 @@ func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementP // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountSetManagementPolicyHotTierActions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountSetManagementPolicyHotTierActions.json func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementPolicyHotTierActions() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -576,7 +576,7 @@ func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementP // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountSetManagementPolicyWithSnapshotAndVersion.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountSetManagementPolicyWithSnapshotAndVersion.json func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementPolicyWithSnapshotAndVersion() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -709,7 +709,7 @@ func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementP // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountSetManagementPolicy_BaseBlobDaysAfterCreationActions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountSetManagementPolicy_BaseBlobDaysAfterCreationActions.json func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementPolicyBaseBlobDaysAfterCreationActions() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -798,7 +798,7 @@ func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementP // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountSetManagementPolicy_LastAccessTimeBasedBlobActions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountSetManagementPolicy_LastAccessTimeBasedBlobActions.json func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -899,7 +899,7 @@ func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementP // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountSetManagementPolicy_LastTierChangeTimeActions.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountSetManagementPolicy_LastTierChangeTimeActions.json func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementPolicyLastTierChangeTimeActions() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1014,7 +1014,7 @@ func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementP // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountDeleteManagementPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountDeleteManagementPolicy.json func ExampleManagementPoliciesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/models.go b/sdk/resourcemanager/storage/armstorage/models.go index 10034127708a..3a9b23aabe0b 100644 --- a/sdk/resourcemanager/storage/armstorage/models.go +++ b/sdk/resourcemanager/storage/armstorage/models.go @@ -181,13 +181,46 @@ type AccountMicrosoftEndpoints struct { Web *string } +// AccountMigration - The parameters or status associated with an ongoing or enqueued storage account migration in order to +// update its current SKU or region. +type AccountMigration struct { + // REQUIRED; The properties of a storage account’s ongoing or enqueued migration. + StorageAccountMigrationDetails *AccountMigrationProperties + + // current value is 'default' for customer initiated migration + Name *string + + // SrpAccountMigrationType in ARM contract which is 'accountMigrations' + Type *string + + // READ-ONLY; Migration Resource Id + ID *string +} + +// AccountMigrationProperties - The properties of a storage account’s ongoing or enqueued migration. +type AccountMigrationProperties struct { + // REQUIRED; Target sku name for the account + TargetSKUName *SKUName + + // READ-ONLY; Reason for migration failure + MigrationFailedDetailedReason *string + + // READ-ONLY; Error code for migration failure + MigrationFailedReason *string + + // READ-ONLY; Current status of migration + MigrationStatus *MigrationStatus +} + // AccountProperties - Properties of the storage account. type AccountProperties struct { - // Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for - // this property. + // Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is false + // for this property. AllowBlobPublicAccess *bool - // Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. + // Allow or disallow cross AAD tenant object replication. Set this property to true for new or existing accounts only if object + // replication policies will involve storage accounts in different AAD + // tenants. The default interpretation is false for new accounts to follow best security practices by default. AllowCrossTenantReplication *bool // Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If @@ -249,6 +282,9 @@ type AccountProperties struct { // be changed for the premium block blobs storage account type. AccessTier *AccessTier + // READ-ONLY; If customer initiated account migration is in progress, the value will be true else it will be null. + AccountMigrationInProgress *bool + // READ-ONLY; Blob restore status BlobRestoreStatus *BlobRestoreStatus @@ -267,6 +303,9 @@ type AccountProperties struct { // READ-ONLY; Geo Replication Stats GeoReplicationStats *GeoReplicationStats + // READ-ONLY; This property will be set to true or false on an event of ongoing migration. Default value is null. + IsSKUConversionBlocked *bool + // READ-ONLY; Storage account keys creation time. KeyCreationTime *KeyCreationTime @@ -320,11 +359,13 @@ type AccountPropertiesCreateParameters struct { // be changed for the premium block blobs storage account type. AccessTier *AccessTier - // Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for - // this property. + // Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is false + // for this property. AllowBlobPublicAccess *bool - // Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. + // Allow or disallow cross AAD tenant object replication. Set this property to true for new or existing accounts only if object + // replication policies will involve storage accounts in different AAD + // tenants. The default interpretation is false for new accounts to follow best security practices by default. AllowCrossTenantReplication *bool // Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If @@ -403,11 +444,13 @@ type AccountPropertiesUpdateParameters struct { // be changed for the premium block blobs storage account type. AccessTier *AccessTier - // Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is true for - // this property. + // Allow or disallow public access to all blobs or containers in the storage account. The default interpretation is false + // for this property. AllowBlobPublicAccess *bool - // Allow or disallow cross AAD tenant object replication. The default interpretation is true for this property. + // Allow or disallow cross AAD tenant object replication. Set this property to true for new or existing accounts only if object + // replication policies will involve storage accounts in different AAD + // tenants. The default interpretation is false for new accounts to follow best security practices by default. AllowCrossTenantReplication *bool // Indicates whether the storage account permits requests to be authorized with the account access key via Shared Key. If @@ -618,6 +661,13 @@ type BlobContainer struct { Type *string } +// BlobInventoryCreationTime - This property defines the creation time based filtering condition. Blob Inventory schema parameter +// 'Creation-Time' is mandatory with this filter. +type BlobInventoryCreationTime struct { + // When set the policy filters the objects that are created in the last N days. Where N is an integer value between 1 to 36500. + LastNDays *int32 +} + // BlobInventoryPolicy - The storage account blob inventory policy. type BlobInventoryPolicy struct { // Returns the storage account blob inventory policy rules. @@ -680,6 +730,9 @@ type BlobInventoryPolicyFilter struct { // 'Blob'. BlobTypes []*string + // This property is used to filter objects based on the object creation time + CreationTime *BlobInventoryCreationTime + // An array of strings with maximum 10 blob prefixes to be excluded from the inventory. ExcludePrefix []*string @@ -1218,12 +1271,46 @@ type Endpoints struct { Web *string } +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any + + // READ-ONLY; The additional info type. + Type *string +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetail + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + // ErrorResponse - An error response from the storage resource provider. type ErrorResponse struct { // Azure Storage Resource Provider error response body. Error *ErrorResponseBody } +// ErrorResponseAutoGenerated - Common error response for all Azure Resource Manager APIs to return error details for failed +// operations. (This also follows the OData error response format.). +type ErrorResponseAutoGenerated struct { + // The error object. + Error *ErrorDetail +} + // ErrorResponseBody - Error response body contract. type ErrorResponseBody struct { // An identifier for the error. Codes are invariant and are intended to be consumed programmatically. @@ -1392,11 +1479,20 @@ type GeoReplicationStats struct { // READ-ONLY; A boolean flag which indicates whether or not account failover is supported for the account. CanFailover *bool + // READ-ONLY; A boolean flag which indicates whether or not planned account failover is supported for the account. + CanPlannedFailover *bool + // READ-ONLY; All primary writes preceding this UTC date/time value are guaranteed to be available for read operations. Primary // writes following this point in time may or may not be available for reads. Element may // be default value if value of LastSyncTime is not available, this can happen if secondary is offline or we are in bootstrap. LastSyncTime *time.Time + // READ-ONLY; The redundancy type of the account after an account failover is performed. + PostFailoverRedundancy *PostFailoverRedundancy + + // READ-ONLY; The redundancy type of the account after a planned account failover is performed. + PostPlannedFailoverRedundancy *PostPlannedFailoverRedundancy + // READ-ONLY; The status of the secondary location. Possible values are: - Live: Indicates that the secondary location is // active and operational. - Bootstrap: Indicates initial synchronization from the primary // location to the secondary location is in progress.This typically occurs when replication is first enabled. - Unavailable: diff --git a/sdk/resourcemanager/storage/armstorage/models_serde.go b/sdk/resourcemanager/storage/armstorage/models_serde.go index e48c343882e4..a4a8557d0b8d 100644 --- a/sdk/resourcemanager/storage/armstorage/models_serde.go +++ b/sdk/resourcemanager/storage/armstorage/models_serde.go @@ -413,10 +413,89 @@ func (a *AccountMicrosoftEndpoints) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AccountMigration. +func (a AccountMigration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.StorageAccountMigrationDetails) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountMigration. +func (a *AccountMigration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "StorageAccountMigrationDetails", &a.StorageAccountMigrationDetails) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AccountMigrationProperties. +func (a AccountMigrationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "migrationFailedDetailedReason", a.MigrationFailedDetailedReason) + populate(objectMap, "migrationFailedReason", a.MigrationFailedReason) + populate(objectMap, "migrationStatus", a.MigrationStatus) + populate(objectMap, "targetSkuName", a.TargetSKUName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccountMigrationProperties. +func (a *AccountMigrationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "migrationFailedDetailedReason": + err = unpopulate(val, "MigrationFailedDetailedReason", &a.MigrationFailedDetailedReason) + delete(rawMsg, key) + case "migrationFailedReason": + err = unpopulate(val, "MigrationFailedReason", &a.MigrationFailedReason) + delete(rawMsg, key) + case "migrationStatus": + err = unpopulate(val, "MigrationStatus", &a.MigrationStatus) + delete(rawMsg, key) + case "targetSkuName": + err = unpopulate(val, "TargetSKUName", &a.TargetSKUName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AccountProperties. func (a AccountProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "accessTier", a.AccessTier) + populate(objectMap, "accountMigrationInProgress", a.AccountMigrationInProgress) populate(objectMap, "allowBlobPublicAccess", a.AllowBlobPublicAccess) populate(objectMap, "allowCrossTenantReplication", a.AllowCrossTenantReplication) populate(objectMap, "allowSharedKeyAccess", a.AllowSharedKeyAccess) @@ -435,6 +514,7 @@ func (a AccountProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "immutableStorageWithVersioning", a.ImmutableStorageWithVersioning) populate(objectMap, "isHnsEnabled", a.IsHnsEnabled) populate(objectMap, "isLocalUserEnabled", a.IsLocalUserEnabled) + populate(objectMap, "isSkuConversionBlocked", a.IsSKUConversionBlocked) populate(objectMap, "isSftpEnabled", a.IsSftpEnabled) populate(objectMap, "keyCreationTime", a.KeyCreationTime) populate(objectMap, "keyPolicy", a.KeyPolicy) @@ -469,6 +549,9 @@ func (a *AccountProperties) UnmarshalJSON(data []byte) error { case "accessTier": err = unpopulate(val, "AccessTier", &a.AccessTier) delete(rawMsg, key) + case "accountMigrationInProgress": + err = unpopulate(val, "AccountMigrationInProgress", &a.AccountMigrationInProgress) + delete(rawMsg, key) case "allowBlobPublicAccess": err = unpopulate(val, "AllowBlobPublicAccess", &a.AllowBlobPublicAccess) delete(rawMsg, key) @@ -523,6 +606,9 @@ func (a *AccountProperties) UnmarshalJSON(data []byte) error { case "isLocalUserEnabled": err = unpopulate(val, "IsLocalUserEnabled", &a.IsLocalUserEnabled) delete(rawMsg, key) + case "isSkuConversionBlocked": + err = unpopulate(val, "IsSKUConversionBlocked", &a.IsSKUConversionBlocked) + delete(rawMsg, key) case "isSftpEnabled": err = unpopulate(val, "IsSftpEnabled", &a.IsSftpEnabled) delete(rawMsg, key) @@ -1146,6 +1232,33 @@ func (b *BlobContainer) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type BlobInventoryCreationTime. +func (b BlobInventoryCreationTime) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "lastNDays", b.LastNDays) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobInventoryCreationTime. +func (b *BlobInventoryCreationTime) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lastNDays": + err = unpopulate(val, "LastNDays", &b.LastNDays) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type BlobInventoryPolicy. func (b BlobInventoryPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1236,6 +1349,7 @@ func (b *BlobInventoryPolicyDefinition) UnmarshalJSON(data []byte) error { func (b BlobInventoryPolicyFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "blobTypes", b.BlobTypes) + populate(objectMap, "creationTime", b.CreationTime) populate(objectMap, "excludePrefix", b.ExcludePrefix) populate(objectMap, "includeBlobVersions", b.IncludeBlobVersions) populate(objectMap, "includeDeleted", b.IncludeDeleted) @@ -1256,6 +1370,9 @@ func (b *BlobInventoryPolicyFilter) UnmarshalJSON(data []byte) error { case "blobTypes": err = unpopulate(val, "BlobTypes", &b.BlobTypes) delete(rawMsg, key) + case "creationTime": + err = unpopulate(val, "CreationTime", &b.CreationTime) + delete(rawMsg, key) case "excludePrefix": err = unpopulate(val, "ExcludePrefix", &b.ExcludePrefix) delete(rawMsg, key) @@ -2519,6 +2636,80 @@ func (e *Endpoints) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ErrorResponse. func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2546,6 +2737,33 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated. +func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated. +func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ErrorResponseBody. func (e ErrorResponseBody) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2929,7 +3147,10 @@ func (f *FileShareProperties) UnmarshalJSON(data []byte) error { func (g GeoReplicationStats) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "canFailover", g.CanFailover) + populate(objectMap, "canPlannedFailover", g.CanPlannedFailover) populateTimeRFC3339(objectMap, "lastSyncTime", g.LastSyncTime) + populate(objectMap, "postFailoverRedundancy", g.PostFailoverRedundancy) + populate(objectMap, "postPlannedFailoverRedundancy", g.PostPlannedFailoverRedundancy) populate(objectMap, "status", g.Status) return json.Marshal(objectMap) } @@ -2946,9 +3167,18 @@ func (g *GeoReplicationStats) UnmarshalJSON(data []byte) error { case "canFailover": err = unpopulate(val, "CanFailover", &g.CanFailover) delete(rawMsg, key) + case "canPlannedFailover": + err = unpopulate(val, "CanPlannedFailover", &g.CanPlannedFailover) + delete(rawMsg, key) case "lastSyncTime": err = unpopulateTimeRFC3339(val, "LastSyncTime", &g.LastSyncTime) delete(rawMsg, key) + case "postFailoverRedundancy": + err = unpopulate(val, "PostFailoverRedundancy", &g.PostFailoverRedundancy) + delete(rawMsg, key) + case "postPlannedFailoverRedundancy": + err = unpopulate(val, "PostPlannedFailoverRedundancy", &g.PostPlannedFailoverRedundancy) + delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &g.Status) delete(rawMsg, key) @@ -6600,6 +6830,16 @@ func populate(m map[string]any, k string, v any) { } } +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil diff --git a/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client.go b/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client.go index 42783e84b59b..1536ffe0d689 100644 --- a/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client.go +++ b/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client.go @@ -46,7 +46,7 @@ func NewObjectReplicationPoliciesClient(subscriptionID string, credential azcore // CreateOrUpdate - Create or update the object replication policy of the storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -102,7 +102,7 @@ func (client *ObjectReplicationPoliciesClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { @@ -123,7 +123,7 @@ func (client *ObjectReplicationPoliciesClient) createOrUpdateHandleResponse(resp // Delete - Deletes the object replication policy associated with the specified storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -177,7 +177,7 @@ func (client *ObjectReplicationPoliciesClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -186,7 +186,7 @@ func (client *ObjectReplicationPoliciesClient) deleteCreateRequest(ctx context.C // Get - Get the object replication policy of the storage account by policy ID. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -241,7 +241,7 @@ func (client *ObjectReplicationPoliciesClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -258,7 +258,7 @@ func (client *ObjectReplicationPoliciesClient) getHandleResponse(resp *http.Resp // NewListPager - List the object replication policies associated with the storage account. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -308,7 +308,7 @@ func (client *ObjectReplicationPoliciesClient) listCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client_example_test.go b/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client_example_test.go index e16a6fceaf51..bbb58e3d80eb 100644 --- a/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountListObjectReplicationPolicies.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountListObjectReplicationPolicies.json func ExampleObjectReplicationPoliciesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -64,7 +64,7 @@ func ExampleObjectReplicationPoliciesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountGetObjectReplicationPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountGetObjectReplicationPolicy.json func ExampleObjectReplicationPoliciesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -114,7 +114,7 @@ func ExampleObjectReplicationPoliciesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountCreateObjectReplicationPolicyOnDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountCreateObjectReplicationPolicyOnDestination.json func ExampleObjectReplicationPoliciesClient_CreateOrUpdate_storageAccountCreateObjectReplicationPolicyOnDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -170,7 +170,7 @@ func ExampleObjectReplicationPoliciesClient_CreateOrUpdate_storageAccountCreateO // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountCreateObjectReplicationPolicyOnSource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountCreateObjectReplicationPolicyOnSource.json func ExampleObjectReplicationPoliciesClient_CreateOrUpdate_storageAccountCreateObjectReplicationPolicyOnSource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -230,7 +230,7 @@ func ExampleObjectReplicationPoliciesClient_CreateOrUpdate_storageAccountCreateO // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountUpdateObjectReplicationPolicyOnDestination.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountUpdateObjectReplicationPolicyOnDestination.json func ExampleObjectReplicationPoliciesClient_CreateOrUpdate_storageAccountUpdateObjectReplicationPolicyOnDestination() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -296,7 +296,7 @@ func ExampleObjectReplicationPoliciesClient_CreateOrUpdate_storageAccountUpdateO // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountUpdateObjectReplicationPolicyOnSource.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountUpdateObjectReplicationPolicyOnSource.json func ExampleObjectReplicationPoliciesClient_CreateOrUpdate_storageAccountUpdateObjectReplicationPolicyOnSource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -364,7 +364,7 @@ func ExampleObjectReplicationPoliciesClient_CreateOrUpdate_storageAccountUpdateO // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountDeleteObjectReplicationPolicy.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountDeleteObjectReplicationPolicy.json func ExampleObjectReplicationPoliciesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/operations_client.go b/sdk/resourcemanager/storage/armstorage/operations_client.go index 24ea8449a8c5..4fb315aa7b09 100644 --- a/sdk/resourcemanager/storage/armstorage/operations_client.go +++ b/sdk/resourcemanager/storage/armstorage/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available Storage Rest API operations. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -73,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storage/armstorage/operations_client_example_test.go b/sdk/resourcemanager/storage/armstorage/operations_client_example_test.go index 73adbdfb85f8..c37b6c31a036 100644 --- a/sdk/resourcemanager/storage/armstorage/operations_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/operations_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/OperationsList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/OperationsList.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/options.go b/sdk/resourcemanager/storage/armstorage/options.go index 40ecbd4880f3..d143bdb48be4 100644 --- a/sdk/resourcemanager/storage/armstorage/options.go +++ b/sdk/resourcemanager/storage/armstorage/options.go @@ -21,6 +21,13 @@ type AccountsClientBeginCreateOptions struct { ResumeToken string } +// AccountsClientBeginCustomerInitiatedMigrationOptions contains the optional parameters for the AccountsClient.BeginCustomerInitiatedMigration +// method. +type AccountsClientBeginCustomerInitiatedMigrationOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // AccountsClientBeginFailoverOptions contains the optional parameters for the AccountsClient.BeginFailover method. type AccountsClientBeginFailoverOptions struct { // The parameter is set to 'Planned' to indicate whether a Planned failover is requested.. Specifying any value will set the @@ -56,6 +63,12 @@ type AccountsClientDeleteOptions struct { // placeholder for future optional parameters } +// AccountsClientGetCustomerInitiatedMigrationOptions contains the optional parameters for the AccountsClient.GetCustomerInitiatedMigration +// method. +type AccountsClientGetCustomerInitiatedMigrationOptions struct { + // placeholder for future optional parameters +} + // AccountsClientGetPropertiesOptions contains the optional parameters for the AccountsClient.GetProperties method. type AccountsClientGetPropertiesOptions struct { // May be used to expand the properties within account's properties. By default, data is not included when fetching properties. diff --git a/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go b/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go index 7fa15e1dbae7..6e36d82ded1b 100644 --- a/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go +++ b/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go @@ -46,7 +46,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // Delete - Deletes the specified private endpoint connection associated with the storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -98,7 +98,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -107,7 +107,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets the specified private endpoint connection associated with the storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -160,7 +160,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -177,7 +177,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListPager - List all the private endpoint connections associated with the storage account. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -227,7 +227,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -245,7 +245,7 @@ func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Re // Put - Update the state of specified private endpoint connection associated with the storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -299,7 +299,7 @@ func (client *PrivateEndpointConnectionsClient) putCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client_example_test.go index e5498c83a81d..82896d65f2b4 100644 --- a/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountListPrivateEndpointConnections.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountListPrivateEndpointConnections.json func ExamplePrivateEndpointConnectionsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -78,7 +78,7 @@ func ExamplePrivateEndpointConnectionsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountGetPrivateEndpointConnection.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountGetPrivateEndpointConnection.json func ExamplePrivateEndpointConnectionsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -114,7 +114,7 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountPutPrivateEndpointConnection.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountPutPrivateEndpointConnection.json func ExamplePrivateEndpointConnectionsClient_Put() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -157,7 +157,7 @@ func ExamplePrivateEndpointConnectionsClient_Put() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountDeletePrivateEndpointConnection.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountDeletePrivateEndpointConnection.json func ExamplePrivateEndpointConnectionsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/privatelinkresources_client.go b/sdk/resourcemanager/storage/armstorage/privatelinkresources_client.go index c02c8331a822..d2520e59f7de 100644 --- a/sdk/resourcemanager/storage/armstorage/privatelinkresources_client.go +++ b/sdk/resourcemanager/storage/armstorage/privatelinkresources_client.go @@ -46,7 +46,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // ListByStorageAccount - Gets the private link resources that need to be created for a storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -94,7 +94,7 @@ func (client *PrivateLinkResourcesClient) listByStorageAccountCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storage/armstorage/privatelinkresources_client_example_test.go b/sdk/resourcemanager/storage/armstorage/privatelinkresources_client_example_test.go index 8f62ce3e3f1a..be1088f21a7d 100644 --- a/sdk/resourcemanager/storage/armstorage/privatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/privatelinkresources_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountListPrivateLinkResources.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountListPrivateLinkResources.json func ExamplePrivateLinkResourcesClient_ListByStorageAccount() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/queue_client.go b/sdk/resourcemanager/storage/armstorage/queue_client.go index c3b0a0befb50..fb7f6a008771 100644 --- a/sdk/resourcemanager/storage/armstorage/queue_client.go +++ b/sdk/resourcemanager/storage/armstorage/queue_client.go @@ -46,7 +46,7 @@ func NewQueueClient(subscriptionID string, credential azcore.TokenCredential, op // Create - Creates a new queue with the specified queue name, under the specified account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -101,7 +101,7 @@ func (client *QueueClient) createCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, queue); err != nil { @@ -122,7 +122,7 @@ func (client *QueueClient) createHandleResponse(resp *http.Response) (QueueClien // Delete - Deletes the queue with the specified queue name, under the specified account if it exists. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -175,7 +175,7 @@ func (client *QueueClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -184,7 +184,7 @@ func (client *QueueClient) deleteCreateRequest(ctx context.Context, resourceGrou // Get - Gets the queue with the specified queue name, under the specified account if it exists. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -238,7 +238,7 @@ func (client *QueueClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -255,7 +255,7 @@ func (client *QueueClient) getHandleResponse(resp *http.Response) (QueueClientGe // NewListPager - Gets a list of all the queues under the specified storage account // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -310,7 +310,7 @@ func (client *QueueClient) listCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") if options != nil && options.Maxpagesize != nil { reqQP.Set("$maxpagesize", *options.Maxpagesize) } @@ -334,7 +334,7 @@ func (client *QueueClient) listHandleResponse(resp *http.Response) (QueueClientL // Update - Creates a new queue with the specified queue name, under the specified account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -389,7 +389,7 @@ func (client *QueueClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, queue); err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/queue_client_example_test.go b/sdk/resourcemanager/storage/armstorage/queue_client_example_test.go index 635c16bbd07e..219ca9b67ccf 100644 --- a/sdk/resourcemanager/storage/armstorage/queue_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/queue_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/QueueOperationPut.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/QueueOperationPut.json func ExampleQueueClient_Create_queueOperationPut() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -43,7 +43,7 @@ func ExampleQueueClient_Create_queueOperationPut() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/QueueOperationPutWithMetadata.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/QueueOperationPutWithMetadata.json func ExampleQueueClient_Create_queueOperationPutWithMetadata() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -81,7 +81,7 @@ func ExampleQueueClient_Create_queueOperationPutWithMetadata() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/QueueOperationPatch.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/QueueOperationPatch.json func ExampleQueueClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -106,7 +106,7 @@ func ExampleQueueClient_Update() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/QueueOperationGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/QueueOperationGet.json func ExampleQueueClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -137,7 +137,7 @@ func ExampleQueueClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/QueueOperationDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/QueueOperationDelete.json func ExampleQueueClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -154,7 +154,7 @@ func ExampleQueueClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/QueueOperationList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/QueueOperationList.json func ExampleQueueClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/queueservices_client.go b/sdk/resourcemanager/storage/armstorage/queueservices_client.go index 21e2f89e3ac5..e2946bce9d60 100644 --- a/sdk/resourcemanager/storage/armstorage/queueservices_client.go +++ b/sdk/resourcemanager/storage/armstorage/queueservices_client.go @@ -47,7 +47,7 @@ func NewQueueServicesClient(subscriptionID string, credential azcore.TokenCreden // and CORS (Cross-Origin Resource Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -96,7 +96,7 @@ func (client *QueueServicesClient) getServicePropertiesCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,7 +114,7 @@ func (client *QueueServicesClient) getServicePropertiesHandleResponse(resp *http // List - List all queue services for the storage account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -161,7 +161,7 @@ func (client *QueueServicesClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +180,7 @@ func (client *QueueServicesClient) listHandleResponse(resp *http.Response) (Queu // and CORS (Cross-Origin Resource Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -231,7 +231,7 @@ func (client *QueueServicesClient) setServicePropertiesCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/queueservices_client_example_test.go b/sdk/resourcemanager/storage/armstorage/queueservices_client_example_test.go index 915266955ba1..22d24d78c19e 100644 --- a/sdk/resourcemanager/storage/armstorage/queueservices_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/queueservices_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/QueueServicesList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/QueueServicesList.json func ExampleQueueServicesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -96,7 +96,7 @@ func ExampleQueueServicesClient_List() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/QueueServicesPut.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/QueueServicesPut.json func ExampleQueueServicesClient_SetServiceProperties() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -222,7 +222,7 @@ func ExampleQueueServicesClient_SetServiceProperties() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/QueueServicesGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/QueueServicesGet.json func ExampleQueueServicesClient_GetServiceProperties() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/response_types.go b/sdk/resourcemanager/storage/armstorage/response_types.go index 4a6a2ccf8513..e5b7eb742cea 100644 --- a/sdk/resourcemanager/storage/armstorage/response_types.go +++ b/sdk/resourcemanager/storage/armstorage/response_types.go @@ -25,6 +25,11 @@ type AccountsClientCreateResponse struct { Account } +// AccountsClientCustomerInitiatedMigrationResponse contains the response from method AccountsClient.BeginCustomerInitiatedMigration. +type AccountsClientCustomerInitiatedMigrationResponse struct { + // placeholder for future response values +} + // AccountsClientDeleteResponse contains the response from method AccountsClient.Delete. type AccountsClientDeleteResponse struct { // placeholder for future response values @@ -35,6 +40,13 @@ type AccountsClientFailoverResponse struct { // placeholder for future response values } +// AccountsClientGetCustomerInitiatedMigrationResponse contains the response from method AccountsClient.GetCustomerInitiatedMigration. +type AccountsClientGetCustomerInitiatedMigrationResponse struct { + // The parameters or status associated with an ongoing or enqueued storage account migration in order to update its current + // SKU or region. + AccountMigration +} + // AccountsClientGetPropertiesResponse contains the response from method AccountsClient.GetProperties. type AccountsClientGetPropertiesResponse struct { // The storage account. diff --git a/sdk/resourcemanager/storage/armstorage/skus_client.go b/sdk/resourcemanager/storage/armstorage/skus_client.go index 36433821a32b..f0549b1b5baa 100644 --- a/sdk/resourcemanager/storage/armstorage/skus_client.go +++ b/sdk/resourcemanager/storage/armstorage/skus_client.go @@ -45,7 +45,7 @@ func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, opt // NewListPager - Lists the available SKUs supported by Microsoft.Storage for given subscription. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - options - SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. func (client *SKUsClient) NewListPager(options *SKUsClientListOptions) *runtime.Pager[SKUsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SKUsClientListResponse]{ @@ -83,7 +83,7 @@ func (client *SKUsClient) listCreateRequest(ctx context.Context, options *SKUsCl return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storage/armstorage/skus_client_example_test.go b/sdk/resourcemanager/storage/armstorage/skus_client_example_test.go index f62bf5ba8abc..1e5d71ecba4d 100644 --- a/sdk/resourcemanager/storage/armstorage/skus_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/skus_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/SKUList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/SKUList.json func ExampleSKUsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/table_client.go b/sdk/resourcemanager/storage/armstorage/table_client.go index 8dd973a7cb7d..8772a4e3f5d9 100644 --- a/sdk/resourcemanager/storage/armstorage/table_client.go +++ b/sdk/resourcemanager/storage/armstorage/table_client.go @@ -46,7 +46,7 @@ func NewTableClient(subscriptionID string, credential azcore.TokenCredential, op // Create - Creates a new table with the specified table name, under the specified account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -99,7 +99,7 @@ func (client *TableClient) createCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Parameters != nil { @@ -123,7 +123,7 @@ func (client *TableClient) createHandleResponse(resp *http.Response) (TableClien // Delete - Deletes the table with the specified table name, under the specified account if it exists. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -175,7 +175,7 @@ func (client *TableClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -184,7 +184,7 @@ func (client *TableClient) deleteCreateRequest(ctx context.Context, resourceGrou // Get - Gets the table with the specified table name, under the specified account if it exists. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -237,7 +237,7 @@ func (client *TableClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -254,7 +254,7 @@ func (client *TableClient) getHandleResponse(resp *http.Response) (TableClientGe // NewListPager - Gets a list of all the tables under the specified storage account // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -309,7 +309,7 @@ func (client *TableClient) listCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -327,7 +327,7 @@ func (client *TableClient) listHandleResponse(resp *http.Response) (TableClientL // Update - Creates a new table with the specified table name, under the specified account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -380,7 +380,7 @@ func (client *TableClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Parameters != nil { diff --git a/sdk/resourcemanager/storage/armstorage/table_client_example_test.go b/sdk/resourcemanager/storage/armstorage/table_client_example_test.go index b24c5f9d026c..568dcb32cfad 100644 --- a/sdk/resourcemanager/storage/armstorage/table_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/table_client_example_test.go @@ -20,7 +20,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/TableOperationPut.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/TableOperationPut.json func ExampleTableClient_Create_tableOperationPut() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -48,7 +48,7 @@ func ExampleTableClient_Create_tableOperationPut() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/TableOperationPutOrPatchAcls.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/TableOperationPutOrPatchAcls.json func ExampleTableClient_Create_tableOperationPutOrPatchAcls() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -114,7 +114,7 @@ func ExampleTableClient_Create_tableOperationPutOrPatchAcls() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/TableOperationPatch.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/TableOperationPatch.json func ExampleTableClient_Update_tableOperationPatch() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -142,7 +142,7 @@ func ExampleTableClient_Update_tableOperationPatch() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/TableOperationGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/TableOperationGet.json func ExampleTableClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -170,7 +170,7 @@ func ExampleTableClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/TableOperationDelete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/TableOperationDelete.json func ExampleTableClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -187,7 +187,7 @@ func ExampleTableClient_Delete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/TableOperationList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/TableOperationList.json func ExampleTableClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/tableservices_client.go b/sdk/resourcemanager/storage/armstorage/tableservices_client.go index 010189120092..bd288a9cfb40 100644 --- a/sdk/resourcemanager/storage/armstorage/tableservices_client.go +++ b/sdk/resourcemanager/storage/armstorage/tableservices_client.go @@ -47,7 +47,7 @@ func NewTableServicesClient(subscriptionID string, credential azcore.TokenCreden // and CORS (Cross-Origin Resource Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -96,7 +96,7 @@ func (client *TableServicesClient) getServicePropertiesCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,7 +114,7 @@ func (client *TableServicesClient) getServicePropertiesHandleResponse(resp *http // List - List all table services for the storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -161,7 +161,7 @@ func (client *TableServicesClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +180,7 @@ func (client *TableServicesClient) listHandleResponse(resp *http.Response) (Tabl // and CORS (Cross-Origin Resource Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // - accountName - The name of the storage account within the specified resource group. Storage account names must be between // 3 and 24 characters in length and use numbers and lower-case letters only. @@ -231,7 +231,7 @@ func (client *TableServicesClient) setServicePropertiesCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/tableservices_client_example_test.go b/sdk/resourcemanager/storage/armstorage/tableservices_client_example_test.go index bfa1c33c5ce4..8ced4a1f565f 100644 --- a/sdk/resourcemanager/storage/armstorage/tableservices_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/tableservices_client_example_test.go @@ -18,7 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/TableServicesList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/TableServicesList.json func ExampleTableServicesClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -96,7 +96,7 @@ func ExampleTableServicesClient_List() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/TableServicesPut.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/TableServicesPut.json func ExampleTableServicesClient_SetServiceProperties() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -222,7 +222,7 @@ func ExampleTableServicesClient_SetServiceProperties() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/TableServicesGet.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/TableServicesGet.json func ExampleTableServicesClient_GetServiceProperties() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/storage/armstorage/usages_client.go b/sdk/resourcemanager/storage/armstorage/usages_client.go index 43b4c6808002..596948504156 100644 --- a/sdk/resourcemanager/storage/armstorage/usages_client.go +++ b/sdk/resourcemanager/storage/armstorage/usages_client.go @@ -45,7 +45,7 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o // NewListByLocationPager - Gets the current usage count and the limit for the resources of the location under the subscription. // -// Generated from API version 2022-09-01 +// Generated from API version 2023-01-01 // - location - The location of the Azure Storage resource. // - options - UsagesClientListByLocationOptions contains the optional parameters for the UsagesClient.NewListByLocationPager // method. @@ -89,7 +89,7 @@ func (client *UsagesClient) listByLocationCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-09-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storage/armstorage/usages_client_example_test.go b/sdk/resourcemanager/storage/armstorage/usages_client_example_test.go index 060d279dc124..81e3f582d01c 100644 --- a/sdk/resourcemanager/storage/armstorage/usages_client_example_test.go +++ b/sdk/resourcemanager/storage/armstorage/usages_client_example_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b32e1896f30e6ea155449cb49719a6286e32b961/specification/storage/resource-manager/Microsoft.Storage/stable/2022-09-01/examples/StorageAccountListLocationUsage.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/Microsoft.Storage/stable/2023-01-01/examples/StorageAccountListLocationUsage.json func ExampleUsagesClient_NewListByLocationPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { From 46beb31e8d990c0a34af2925f442655706d6887a Mon Sep 17 00:00:00 2001 From: Alancere <804873052@qq.com> Date: Wed, 23 Aug 2023 14:35:27 +0800 Subject: [PATCH 2/3] stable remove fake and update assets.json --- .../storage/armstorage/accounts_client.go | 68 -- .../storage/armstorage/assets.json | 2 +- .../storage/armstorage/autorest.md | 4 - .../armstorage/blobcontainers_client.go | 54 - .../blobinventorypolicies_client.go | 14 - .../storage/armstorage/blobservices_client.go | 10 - .../armstorage/deletedaccounts_client.go | 6 - .../armstorage/encryptionscopes_client.go | 14 - .../armstorage/fake/accounts_server.go | 921 ------------------ .../armstorage/fake/blobcontainers_server.go | 780 --------------- .../fake/blobinventorypolicies_server.go | 242 ----- .../armstorage/fake/blobservices_server.go | 191 ---- .../armstorage/fake/deletedaccounts_server.go | 144 --- .../fake/encryptionscopes_server.go | 284 ------ .../armstorage/fake/fileservices_server.go | 182 ---- .../armstorage/fake/fileshares_server.go | 463 --------- .../storage/armstorage/fake/internal.go | 123 --- .../armstorage/fake/localusers_server.go | 328 ------- .../fake/managementpolicies_server.go | 194 ---- .../fake/objectreplicationpolicies_server.go | 242 ----- .../armstorage/fake/operations_server.go | 92 -- .../fake/privateendpointconnections_server.go | 242 ----- .../fake/privatelinkresources_server.go | 100 -- .../storage/armstorage/fake/queue_server.go | 311 ------ .../armstorage/fake/queueservices_server.go | 182 ---- .../storage/armstorage/fake/skus_server.go | 99 -- .../storage/armstorage/fake/table_server.go | 306 ------ .../armstorage/fake/tableservices_server.go | 182 ---- .../storage/armstorage/fake/time_rfc3339.go | 86 -- .../storage/armstorage/fake/usages_server.go | 104 -- .../storage/armstorage/fake_example_test.go | 79 -- .../storage/armstorage/fileservices_client.go | 12 - .../storage/armstorage/fileshares_client.go | 26 - .../storage/armstorage/localusers_client.go | 22 - .../armstorage/managementpolicies_client.go | 12 - .../objectreplicationpolicies_client.go | 14 - .../storage/armstorage/operations_client.go | 2 - .../privateendpointconnections_client.go | 14 - .../armstorage/privatelinkresources_client.go | 4 - .../storage/armstorage/queue_client.go | 18 - .../armstorage/queueservices_client.go | 12 - .../storage/armstorage/skus_client.go | 2 - .../storage/armstorage/table_client.go | 18 - .../armstorage/tableservices_client.go | 12 - .../storage/armstorage/usages_client.go | 2 - 45 files changed, 1 insertion(+), 6218 deletions(-) delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/accounts_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/blobcontainers_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/blobinventorypolicies_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/blobservices_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/deletedaccounts_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/encryptionscopes_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/fileservices_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/fileshares_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/internal.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/localusers_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/managementpolicies_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/objectreplicationpolicies_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/operations_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/privateendpointconnections_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/privatelinkresources_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/queue_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/queueservices_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/skus_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/table_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/tableservices_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake/usages_server.go delete mode 100644 sdk/resourcemanager/storage/armstorage/fake_example_test.go diff --git a/sdk/resourcemanager/storage/armstorage/accounts_client.go b/sdk/resourcemanager/storage/armstorage/accounts_client.go index d135df24e7f2..9dda7d4b32f7 100644 --- a/sdk/resourcemanager/storage/armstorage/accounts_client.go +++ b/sdk/resourcemanager/storage/armstorage/accounts_client.go @@ -73,10 +73,6 @@ func (client *AccountsClient) BeginAbortHierarchicalNamespaceMigration(ctx conte // Generated from API version 2023-01-01 func (client *AccountsClient) abortHierarchicalNamespaceMigration(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginAbortHierarchicalNamespaceMigrationOptions) (*http.Response, error) { var err error - const operationName = "AccountsClient.BeginAbortHierarchicalNamespaceMigration" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.abortHierarchicalNamespaceMigrationCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return nil, err @@ -128,10 +124,6 @@ func (client *AccountsClient) abortHierarchicalNamespaceMigrationCreateRequest(c // method. func (client *AccountsClient) CheckNameAvailability(ctx context.Context, accountName AccountCheckNameAvailabilityParameters, options *AccountsClientCheckNameAvailabilityOptions) (AccountsClientCheckNameAvailabilityResponse, error) { var err error - const operationName = "AccountsClient.CheckNameAvailability" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.checkNameAvailabilityCreateRequest(ctx, accountName, options) if err != nil { return AccountsClientCheckNameAvailabilityResponse{}, err @@ -212,10 +204,6 @@ func (client *AccountsClient) BeginCreate(ctx context.Context, resourceGroupName // Generated from API version 2023-01-01 func (client *AccountsClient) create(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters, options *AccountsClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "AccountsClient.BeginCreate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, parameters, options) if err != nil { return nil, err @@ -297,10 +285,6 @@ func (client *AccountsClient) BeginCustomerInitiatedMigration(ctx context.Contex // Generated from API version 2023-01-01 func (client *AccountsClient) customerInitiatedMigration(ctx context.Context, resourceGroupName string, accountName string, parameters AccountMigration, options *AccountsClientBeginCustomerInitiatedMigrationOptions) (*http.Response, error) { var err error - const operationName = "AccountsClient.BeginCustomerInitiatedMigration" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.customerInitiatedMigrationCreateRequest(ctx, resourceGroupName, accountName, parameters, options) if err != nil { return nil, err @@ -355,10 +339,6 @@ func (client *AccountsClient) customerInitiatedMigrationCreateRequest(ctx contex // - options - AccountsClientDeleteOptions contains the optional parameters for the AccountsClient.Delete method. func (client *AccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientDeleteOptions) (AccountsClientDeleteResponse, error) { var err error - const operationName = "AccountsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return AccountsClientDeleteResponse{}, err @@ -444,10 +424,6 @@ func (client *AccountsClient) BeginFailover(ctx context.Context, resourceGroupNa // Generated from API version 2023-01-01 func (client *AccountsClient) failover(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginFailoverOptions) (*http.Response, error) { var err error - const operationName = "AccountsClient.BeginFailover" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.failoverCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return nil, err @@ -503,10 +479,6 @@ func (client *AccountsClient) failoverCreateRequest(ctx context.Context, resourc // method. func (client *AccountsClient) GetCustomerInitiatedMigration(ctx context.Context, resourceGroupName string, accountName string, migrationName MigrationName, options *AccountsClientGetCustomerInitiatedMigrationOptions) (AccountsClientGetCustomerInitiatedMigrationResponse, error) { var err error - const operationName = "AccountsClient.GetCustomerInitiatedMigration" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCustomerInitiatedMigrationCreateRequest(ctx, resourceGroupName, accountName, migrationName, options) if err != nil { return AccountsClientGetCustomerInitiatedMigrationResponse{}, err @@ -573,10 +545,6 @@ func (client *AccountsClient) getCustomerInitiatedMigrationHandleResponse(resp * // - options - AccountsClientGetPropertiesOptions contains the optional parameters for the AccountsClient.GetProperties method. func (client *AccountsClient) GetProperties(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientGetPropertiesOptions) (AccountsClientGetPropertiesResponse, error) { var err error - const operationName = "AccountsClient.GetProperties" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getPropertiesCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return AccountsClientGetPropertiesResponse{}, err @@ -664,10 +632,6 @@ func (client *AccountsClient) BeginHierarchicalNamespaceMigration(ctx context.Co // Generated from API version 2023-01-01 func (client *AccountsClient) hierarchicalNamespaceMigration(ctx context.Context, resourceGroupName string, accountName string, requestType string, options *AccountsClientBeginHierarchicalNamespaceMigrationOptions) (*http.Response, error) { var err error - const operationName = "AccountsClient.BeginHierarchicalNamespaceMigration" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.hierarchicalNamespaceMigrationCreateRequest(ctx, resourceGroupName, accountName, requestType, options) if err != nil { return nil, err @@ -721,7 +685,6 @@ func (client *AccountsClient) NewListPager(options *AccountsClientListOptions) * return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *AccountsClientListResponse) (AccountsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AccountsClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -741,7 +704,6 @@ func (client *AccountsClient) NewListPager(options *AccountsClientListOptions) * } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -783,10 +745,6 @@ func (client *AccountsClient) listHandleResponse(resp *http.Response) (AccountsC // - options - AccountsClientListAccountSASOptions contains the optional parameters for the AccountsClient.ListAccountSAS method. func (client *AccountsClient) ListAccountSAS(ctx context.Context, resourceGroupName string, accountName string, parameters AccountSasParameters, options *AccountsClientListAccountSASOptions) (AccountsClientListAccountSASResponse, error) { var err error - const operationName = "AccountsClient.ListAccountSAS" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.listAccountSASCreateRequest(ctx, resourceGroupName, accountName, parameters, options) if err != nil { return AccountsClientListAccountSASResponse{}, err @@ -854,7 +812,6 @@ func (client *AccountsClient) NewListByResourceGroupPager(resourceGroupName stri return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *AccountsClientListByResourceGroupResponse) (AccountsClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AccountsClient.NewListByResourceGroupPager") var req *policy.Request var err error if page == nil { @@ -874,7 +831,6 @@ func (client *AccountsClient) NewListByResourceGroupPager(resourceGroupName stri } return client.listByResourceGroupHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -919,10 +875,6 @@ func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Respo // - options - AccountsClientListKeysOptions contains the optional parameters for the AccountsClient.ListKeys method. func (client *AccountsClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientListKeysOptions) (AccountsClientListKeysResponse, error) { var err error - const operationName = "AccountsClient.ListKeys" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.listKeysCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return AccountsClientListKeysResponse{}, err @@ -988,10 +940,6 @@ func (client *AccountsClient) listKeysHandleResponse(resp *http.Response) (Accou // - options - AccountsClientListServiceSASOptions contains the optional parameters for the AccountsClient.ListServiceSAS method. func (client *AccountsClient) ListServiceSAS(ctx context.Context, resourceGroupName string, accountName string, parameters ServiceSasParameters, options *AccountsClientListServiceSASOptions) (AccountsClientListServiceSASResponse, error) { var err error - const operationName = "AccountsClient.ListServiceSAS" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.listServiceSASCreateRequest(ctx, resourceGroupName, accountName, parameters, options) if err != nil { return AccountsClientListServiceSASResponse{}, err @@ -1057,10 +1005,6 @@ func (client *AccountsClient) listServiceSASHandleResponse(resp *http.Response) // - options - AccountsClientRegenerateKeyOptions contains the optional parameters for the AccountsClient.RegenerateKey method. func (client *AccountsClient) RegenerateKey(ctx context.Context, resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters, options *AccountsClientRegenerateKeyOptions) (AccountsClientRegenerateKeyResponse, error) { var err error - const operationName = "AccountsClient.RegenerateKey" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, accountName, regenerateKey, options) if err != nil { return AccountsClientRegenerateKeyResponse{}, err @@ -1146,10 +1090,6 @@ func (client *AccountsClient) BeginRestoreBlobRanges(ctx context.Context, resour // Generated from API version 2023-01-01 func (client *AccountsClient) restoreBlobRanges(ctx context.Context, resourceGroupName string, accountName string, parameters BlobRestoreParameters, options *AccountsClientBeginRestoreBlobRangesOptions) (*http.Response, error) { var err error - const operationName = "AccountsClient.BeginRestoreBlobRanges" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.restoreBlobRangesCreateRequest(ctx, resourceGroupName, accountName, parameters, options) if err != nil { return nil, err @@ -1205,10 +1145,6 @@ func (client *AccountsClient) restoreBlobRangesCreateRequest(ctx context.Context // method. func (client *AccountsClient) RevokeUserDelegationKeys(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientRevokeUserDelegationKeysOptions) (AccountsClientRevokeUserDelegationKeysResponse, error) { var err error - const operationName = "AccountsClient.RevokeUserDelegationKeys" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.revokeUserDelegationKeysCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return AccountsClientRevokeUserDelegationKeysResponse{}, err @@ -1266,10 +1202,6 @@ func (client *AccountsClient) revokeUserDelegationKeysCreateRequest(ctx context. // - options - AccountsClientUpdateOptions contains the optional parameters for the AccountsClient.Update method. func (client *AccountsClient) Update(ctx context.Context, resourceGroupName string, accountName string, parameters AccountUpdateParameters, options *AccountsClientUpdateOptions) (AccountsClientUpdateResponse, error) { var err error - const operationName = "AccountsClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, parameters, options) if err != nil { return AccountsClientUpdateResponse{}, err diff --git a/sdk/resourcemanager/storage/armstorage/assets.json b/sdk/resourcemanager/storage/armstorage/assets.json index d4acd66bb7fc..c8da6a3db044 100644 --- a/sdk/resourcemanager/storage/armstorage/assets.json +++ b/sdk/resourcemanager/storage/armstorage/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "go", "TagPrefix": "go/resourcemanager/storage/armstorage", - "Tag": "go/resourcemanager/storage/armstorage_d49f2aa92f" + "Tag": "go/resourcemanager/storage/armstorage_7be6771f42" } diff --git a/sdk/resourcemanager/storage/armstorage/autorest.md b/sdk/resourcemanager/storage/armstorage/autorest.md index 997629954ac8..79e92c675dd8 100644 --- a/sdk/resourcemanager/storage/armstorage/autorest.md +++ b/sdk/resourcemanager/storage/armstorage/autorest.md @@ -8,11 +8,7 @@ require: - https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/readme.md - https://github.com/Azure/azure-rest-api-specs/blob/0baf811c3c76c87b3c127d098519bd97141222dd/specification/storage/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module: github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage module-version: 1.4.0 -azcore-version: 1.8.0-beta.1 -generate-fakes: true -inject-spans: true modelerfour: seal-single-value-enum-by-default: true tag: package-2023-01 diff --git a/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go b/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go index baf54356a13b..ac0a5ab43e5e 100644 --- a/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go +++ b/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go @@ -59,10 +59,6 @@ func NewBlobContainersClient(subscriptionID string, credential azcore.TokenCrede // method. func (client *BlobContainersClient) ClearLegalHold(ctx context.Context, resourceGroupName string, accountName string, containerName string, legalHold LegalHold, options *BlobContainersClientClearLegalHoldOptions) (BlobContainersClientClearLegalHoldResponse, error) { var err error - const operationName = "BlobContainersClient.ClearLegalHold" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.clearLegalHoldCreateRequest(ctx, resourceGroupName, accountName, containerName, legalHold, options) if err != nil { return BlobContainersClientClearLegalHoldResponse{}, err @@ -137,10 +133,6 @@ func (client *BlobContainersClient) clearLegalHoldHandleResponse(resp *http.Resp // - options - BlobContainersClientCreateOptions contains the optional parameters for the BlobContainersClient.Create method. func (client *BlobContainersClient) Create(ctx context.Context, resourceGroupName string, accountName string, containerName string, blobContainer BlobContainer, options *BlobContainersClientCreateOptions) (BlobContainersClientCreateResponse, error) { var err error - const operationName = "BlobContainersClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, containerName, blobContainer, options) if err != nil { return BlobContainersClientCreateResponse{}, err @@ -214,10 +206,6 @@ func (client *BlobContainersClient) createHandleResponse(resp *http.Response) (B // method. func (client *BlobContainersClient) CreateOrUpdateImmutabilityPolicy(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientCreateOrUpdateImmutabilityPolicyOptions) (BlobContainersClientCreateOrUpdateImmutabilityPolicyResponse, error) { var err error - const operationName = "BlobContainersClient.CreateOrUpdateImmutabilityPolicy" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createOrUpdateImmutabilityPolicyCreateRequest(ctx, resourceGroupName, accountName, containerName, options) if err != nil { return BlobContainersClientCreateOrUpdateImmutabilityPolicyResponse{}, err @@ -299,10 +287,6 @@ func (client *BlobContainersClient) createOrUpdateImmutabilityPolicyHandleRespon // - options - BlobContainersClientDeleteOptions contains the optional parameters for the BlobContainersClient.Delete method. func (client *BlobContainersClient) Delete(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientDeleteOptions) (BlobContainersClientDeleteResponse, error) { var err error - const operationName = "BlobContainersClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, containerName, options) if err != nil { return BlobContainersClientDeleteResponse{}, err @@ -367,10 +351,6 @@ func (client *BlobContainersClient) deleteCreateRequest(ctx context.Context, res // method. func (client *BlobContainersClient) DeleteImmutabilityPolicy(ctx context.Context, resourceGroupName string, accountName string, containerName string, ifMatch string, options *BlobContainersClientDeleteImmutabilityPolicyOptions) (BlobContainersClientDeleteImmutabilityPolicyResponse, error) { var err error - const operationName = "BlobContainersClient.DeleteImmutabilityPolicy" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteImmutabilityPolicyCreateRequest(ctx, resourceGroupName, accountName, containerName, ifMatch, options) if err != nil { return BlobContainersClientDeleteImmutabilityPolicyResponse{}, err @@ -449,10 +429,6 @@ func (client *BlobContainersClient) deleteImmutabilityPolicyHandleResponse(resp // method. func (client *BlobContainersClient) ExtendImmutabilityPolicy(ctx context.Context, resourceGroupName string, accountName string, containerName string, ifMatch string, options *BlobContainersClientExtendImmutabilityPolicyOptions) (BlobContainersClientExtendImmutabilityPolicyResponse, error) { var err error - const operationName = "BlobContainersClient.ExtendImmutabilityPolicy" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.extendImmutabilityPolicyCreateRequest(ctx, resourceGroupName, accountName, containerName, ifMatch, options) if err != nil { return BlobContainersClientExtendImmutabilityPolicyResponse{}, err @@ -531,10 +507,6 @@ func (client *BlobContainersClient) extendImmutabilityPolicyHandleResponse(resp // - options - BlobContainersClientGetOptions contains the optional parameters for the BlobContainersClient.Get method. func (client *BlobContainersClient) Get(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientGetOptions) (BlobContainersClientGetResponse, error) { var err error - const operationName = "BlobContainersClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, containerName, options) if err != nil { return BlobContainersClientGetResponse{}, err @@ -605,10 +577,6 @@ func (client *BlobContainersClient) getHandleResponse(resp *http.Response) (Blob // method. func (client *BlobContainersClient) GetImmutabilityPolicy(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientGetImmutabilityPolicyOptions) (BlobContainersClientGetImmutabilityPolicyResponse, error) { var err error - const operationName = "BlobContainersClient.GetImmutabilityPolicy" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getImmutabilityPolicyCreateRequest(ctx, resourceGroupName, accountName, containerName, options) if err != nil { return BlobContainersClientGetImmutabilityPolicyResponse{}, err @@ -685,10 +653,6 @@ func (client *BlobContainersClient) getImmutabilityPolicyHandleResponse(resp *ht // - options - BlobContainersClientLeaseOptions contains the optional parameters for the BlobContainersClient.Lease method. func (client *BlobContainersClient) Lease(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientLeaseOptions) (BlobContainersClientLeaseResponse, error) { var err error - const operationName = "BlobContainersClient.Lease" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.leaseCreateRequest(ctx, resourceGroupName, accountName, containerName, options) if err != nil { return BlobContainersClientLeaseResponse{}, err @@ -764,7 +728,6 @@ func (client *BlobContainersClient) NewListPager(resourceGroupName string, accou return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *BlobContainersClientListResponse) (BlobContainersClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BlobContainersClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -784,7 +747,6 @@ func (client *BlobContainersClient) NewListPager(resourceGroupName string, accou } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -850,10 +812,6 @@ func (client *BlobContainersClient) listHandleResponse(resp *http.Response) (Blo // method. func (client *BlobContainersClient) LockImmutabilityPolicy(ctx context.Context, resourceGroupName string, accountName string, containerName string, ifMatch string, options *BlobContainersClientLockImmutabilityPolicyOptions) (BlobContainersClientLockImmutabilityPolicyResponse, error) { var err error - const operationName = "BlobContainersClient.LockImmutabilityPolicy" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.lockImmutabilityPolicyCreateRequest(ctx, resourceGroupName, accountName, containerName, ifMatch, options) if err != nil { return BlobContainersClientLockImmutabilityPolicyResponse{}, err @@ -950,10 +908,6 @@ func (client *BlobContainersClient) BeginObjectLevelWorm(ctx context.Context, re // Generated from API version 2023-01-01 func (client *BlobContainersClient) objectLevelWorm(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientBeginObjectLevelWormOptions) (*http.Response, error) { var err error - const operationName = "BlobContainersClient.BeginObjectLevelWorm" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.objectLevelWormCreateRequest(ctx, resourceGroupName, accountName, containerName, options) if err != nil { return nil, err @@ -1015,10 +969,6 @@ func (client *BlobContainersClient) objectLevelWormCreateRequest(ctx context.Con // method. func (client *BlobContainersClient) SetLegalHold(ctx context.Context, resourceGroupName string, accountName string, containerName string, legalHold LegalHold, options *BlobContainersClientSetLegalHoldOptions) (BlobContainersClientSetLegalHoldResponse, error) { var err error - const operationName = "BlobContainersClient.SetLegalHold" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.setLegalHoldCreateRequest(ctx, resourceGroupName, accountName, containerName, legalHold, options) if err != nil { return BlobContainersClientSetLegalHoldResponse{}, err @@ -1092,10 +1042,6 @@ func (client *BlobContainersClient) setLegalHoldHandleResponse(resp *http.Respon // - options - BlobContainersClientUpdateOptions contains the optional parameters for the BlobContainersClient.Update method. func (client *BlobContainersClient) Update(ctx context.Context, resourceGroupName string, accountName string, containerName string, blobContainer BlobContainer, options *BlobContainersClientUpdateOptions) (BlobContainersClientUpdateResponse, error) { var err error - const operationName = "BlobContainersClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, containerName, blobContainer, options) if err != nil { return BlobContainersClientUpdateResponse{}, err diff --git a/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go b/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go index 661016d958bb..1620574f71d2 100644 --- a/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go +++ b/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go @@ -56,10 +56,6 @@ func NewBlobInventoryPoliciesClient(subscriptionID string, credential azcore.Tok // method. func (client *BlobInventoryPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName BlobInventoryPolicyName, properties BlobInventoryPolicy, options *BlobInventoryPoliciesClientCreateOrUpdateOptions) (BlobInventoryPoliciesClientCreateOrUpdateResponse, error) { var err error - const operationName = "BlobInventoryPoliciesClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, blobInventoryPolicyName, properties, options) if err != nil { return BlobInventoryPoliciesClientCreateOrUpdateResponse{}, err @@ -130,10 +126,6 @@ func (client *BlobInventoryPoliciesClient) createOrUpdateHandleResponse(resp *ht // method. func (client *BlobInventoryPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName BlobInventoryPolicyName, options *BlobInventoryPoliciesClientDeleteOptions) (BlobInventoryPoliciesClientDeleteResponse, error) { var err error - const operationName = "BlobInventoryPoliciesClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, blobInventoryPolicyName, options) if err != nil { return BlobInventoryPoliciesClientDeleteResponse{}, err @@ -191,10 +183,6 @@ func (client *BlobInventoryPoliciesClient) deleteCreateRequest(ctx context.Conte // method. func (client *BlobInventoryPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName BlobInventoryPolicyName, options *BlobInventoryPoliciesClientGetOptions) (BlobInventoryPoliciesClientGetResponse, error) { var err error - const operationName = "BlobInventoryPoliciesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, blobInventoryPolicyName, options) if err != nil { return BlobInventoryPoliciesClientGetResponse{}, err @@ -264,7 +252,6 @@ func (client *BlobInventoryPoliciesClient) NewListPager(resourceGroupName string return false }, Fetcher: func(ctx context.Context, page *BlobInventoryPoliciesClientListResponse) (BlobInventoryPoliciesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BlobInventoryPoliciesClient.NewListPager") req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return BlobInventoryPoliciesClientListResponse{}, err @@ -278,7 +265,6 @@ func (client *BlobInventoryPoliciesClient) NewListPager(resourceGroupName string } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } diff --git a/sdk/resourcemanager/storage/armstorage/blobservices_client.go b/sdk/resourcemanager/storage/armstorage/blobservices_client.go index 2ebfd3a604a4..bc8917e9e38d 100644 --- a/sdk/resourcemanager/storage/armstorage/blobservices_client.go +++ b/sdk/resourcemanager/storage/armstorage/blobservices_client.go @@ -55,10 +55,6 @@ func NewBlobServicesClient(subscriptionID string, credential azcore.TokenCredent // method. func (client *BlobServicesClient) GetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, options *BlobServicesClientGetServicePropertiesOptions) (BlobServicesClientGetServicePropertiesResponse, error) { var err error - const operationName = "BlobServicesClient.GetServiceProperties" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return BlobServicesClientGetServicePropertiesResponse{}, err @@ -124,7 +120,6 @@ func (client *BlobServicesClient) NewListPager(resourceGroupName string, account return false }, Fetcher: func(ctx context.Context, page *BlobServicesClientListResponse) (BlobServicesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BlobServicesClient.NewListPager") req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return BlobServicesClientListResponse{}, err @@ -138,7 +133,6 @@ func (client *BlobServicesClient) NewListPager(resourceGroupName string, account } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -191,10 +185,6 @@ func (client *BlobServicesClient) listHandleResponse(resp *http.Response) (BlobS // method. func (client *BlobServicesClient) SetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, parameters BlobServiceProperties, options *BlobServicesClientSetServicePropertiesOptions) (BlobServicesClientSetServicePropertiesResponse, error) { var err error - const operationName = "BlobServicesClient.SetServiceProperties" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.setServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, parameters, options) if err != nil { return BlobServicesClientSetServicePropertiesResponse{}, err diff --git a/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go b/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go index ac1f44ed9fa0..80f8b61ff4ff 100644 --- a/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go +++ b/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go @@ -52,10 +52,6 @@ func NewDeletedAccountsClient(subscriptionID string, credential azcore.TokenCred // - options - DeletedAccountsClientGetOptions contains the optional parameters for the DeletedAccountsClient.Get method. func (client *DeletedAccountsClient) Get(ctx context.Context, deletedAccountName string, location string, options *DeletedAccountsClientGetOptions) (DeletedAccountsClientGetResponse, error) { var err error - const operationName = "DeletedAccountsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, deletedAccountName, location, options) if err != nil { return DeletedAccountsClientGetResponse{}, err @@ -118,7 +114,6 @@ func (client *DeletedAccountsClient) NewListPager(options *DeletedAccountsClient return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DeletedAccountsClientListResponse) (DeletedAccountsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DeletedAccountsClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -138,7 +133,6 @@ func (client *DeletedAccountsClient) NewListPager(options *DeletedAccountsClient } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } diff --git a/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go b/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go index 5f0f914c3458..9aa5b6437292 100644 --- a/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go +++ b/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go @@ -57,10 +57,6 @@ func NewEncryptionScopesClient(subscriptionID string, credential azcore.TokenCre // - options - EncryptionScopesClientGetOptions contains the optional parameters for the EncryptionScopesClient.Get method. func (client *EncryptionScopesClient) Get(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, options *EncryptionScopesClientGetOptions) (EncryptionScopesClientGetResponse, error) { var err error - const operationName = "EncryptionScopesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, encryptionScopeName, options) if err != nil { return EncryptionScopesClientGetResponse{}, err @@ -130,7 +126,6 @@ func (client *EncryptionScopesClient) NewListPager(resourceGroupName string, acc return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *EncryptionScopesClientListResponse) (EncryptionScopesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EncryptionScopesClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -150,7 +145,6 @@ func (client *EncryptionScopesClient) NewListPager(resourceGroupName string, acc } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -213,10 +207,6 @@ func (client *EncryptionScopesClient) listHandleResponse(resp *http.Response) (E // - options - EncryptionScopesClientPatchOptions contains the optional parameters for the EncryptionScopesClient.Patch method. func (client *EncryptionScopesClient) Patch(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, encryptionScope EncryptionScope, options *EncryptionScopesClientPatchOptions) (EncryptionScopesClientPatchResponse, error) { var err error - const operationName = "EncryptionScopesClient.Patch" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.patchCreateRequest(ctx, resourceGroupName, accountName, encryptionScopeName, encryptionScope, options) if err != nil { return EncryptionScopesClientPatchResponse{}, err @@ -291,10 +281,6 @@ func (client *EncryptionScopesClient) patchHandleResponse(resp *http.Response) ( // - options - EncryptionScopesClientPutOptions contains the optional parameters for the EncryptionScopesClient.Put method. func (client *EncryptionScopesClient) Put(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, encryptionScope EncryptionScope, options *EncryptionScopesClientPutOptions) (EncryptionScopesClientPutResponse, error) { var err error - const operationName = "EncryptionScopesClient.Put" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.putCreateRequest(ctx, resourceGroupName, accountName, encryptionScopeName, encryptionScope, options) if err != nil { return EncryptionScopesClientPutResponse{}, err diff --git a/sdk/resourcemanager/storage/armstorage/fake/accounts_server.go b/sdk/resourcemanager/storage/armstorage/fake/accounts_server.go deleted file mode 100644 index e4b5a7aca30a..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/accounts_server.go +++ /dev/null @@ -1,921 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "regexp" -) - -// AccountsServer is a fake server for instances of the armstorage.AccountsClient type. -type AccountsServer struct { - // BeginAbortHierarchicalNamespaceMigration is the fake for method AccountsClient.BeginAbortHierarchicalNamespaceMigration - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginAbortHierarchicalNamespaceMigration func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.AccountsClientBeginAbortHierarchicalNamespaceMigrationOptions) (resp azfake.PollerResponder[armstorage.AccountsClientAbortHierarchicalNamespaceMigrationResponse], errResp azfake.ErrorResponder) - - // CheckNameAvailability is the fake for method AccountsClient.CheckNameAvailability - // HTTP status codes to indicate success: http.StatusOK - CheckNameAvailability func(ctx context.Context, accountName armstorage.AccountCheckNameAvailabilityParameters, options *armstorage.AccountsClientCheckNameAvailabilityOptions) (resp azfake.Responder[armstorage.AccountsClientCheckNameAvailabilityResponse], errResp azfake.ErrorResponder) - - // BeginCreate is the fake for method AccountsClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginCreate func(ctx context.Context, resourceGroupName string, accountName string, parameters armstorage.AccountCreateParameters, options *armstorage.AccountsClientBeginCreateOptions) (resp azfake.PollerResponder[armstorage.AccountsClientCreateResponse], errResp azfake.ErrorResponder) - - // BeginCustomerInitiatedMigration is the fake for method AccountsClient.BeginCustomerInitiatedMigration - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginCustomerInitiatedMigration func(ctx context.Context, resourceGroupName string, accountName string, parameters armstorage.AccountMigration, options *armstorage.AccountsClientBeginCustomerInitiatedMigrationOptions) (resp azfake.PollerResponder[armstorage.AccountsClientCustomerInitiatedMigrationResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method AccountsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.AccountsClientDeleteOptions) (resp azfake.Responder[armstorage.AccountsClientDeleteResponse], errResp azfake.ErrorResponder) - - // BeginFailover is the fake for method AccountsClient.BeginFailover - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginFailover func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.AccountsClientBeginFailoverOptions) (resp azfake.PollerResponder[armstorage.AccountsClientFailoverResponse], errResp azfake.ErrorResponder) - - // GetCustomerInitiatedMigration is the fake for method AccountsClient.GetCustomerInitiatedMigration - // HTTP status codes to indicate success: http.StatusOK - GetCustomerInitiatedMigration func(ctx context.Context, resourceGroupName string, accountName string, migrationName armstorage.MigrationName, options *armstorage.AccountsClientGetCustomerInitiatedMigrationOptions) (resp azfake.Responder[armstorage.AccountsClientGetCustomerInitiatedMigrationResponse], errResp azfake.ErrorResponder) - - // GetProperties is the fake for method AccountsClient.GetProperties - // HTTP status codes to indicate success: http.StatusOK - GetProperties func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.AccountsClientGetPropertiesOptions) (resp azfake.Responder[armstorage.AccountsClientGetPropertiesResponse], errResp azfake.ErrorResponder) - - // BeginHierarchicalNamespaceMigration is the fake for method AccountsClient.BeginHierarchicalNamespaceMigration - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginHierarchicalNamespaceMigration func(ctx context.Context, resourceGroupName string, accountName string, requestType string, options *armstorage.AccountsClientBeginHierarchicalNamespaceMigrationOptions) (resp azfake.PollerResponder[armstorage.AccountsClientHierarchicalNamespaceMigrationResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method AccountsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armstorage.AccountsClientListOptions) (resp azfake.PagerResponder[armstorage.AccountsClientListResponse]) - - // ListAccountSAS is the fake for method AccountsClient.ListAccountSAS - // HTTP status codes to indicate success: http.StatusOK - ListAccountSAS func(ctx context.Context, resourceGroupName string, accountName string, parameters armstorage.AccountSasParameters, options *armstorage.AccountsClientListAccountSASOptions) (resp azfake.Responder[armstorage.AccountsClientListAccountSASResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method AccountsClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armstorage.AccountsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armstorage.AccountsClientListByResourceGroupResponse]) - - // ListKeys is the fake for method AccountsClient.ListKeys - // HTTP status codes to indicate success: http.StatusOK - ListKeys func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.AccountsClientListKeysOptions) (resp azfake.Responder[armstorage.AccountsClientListKeysResponse], errResp azfake.ErrorResponder) - - // ListServiceSAS is the fake for method AccountsClient.ListServiceSAS - // HTTP status codes to indicate success: http.StatusOK - ListServiceSAS func(ctx context.Context, resourceGroupName string, accountName string, parameters armstorage.ServiceSasParameters, options *armstorage.AccountsClientListServiceSASOptions) (resp azfake.Responder[armstorage.AccountsClientListServiceSASResponse], errResp azfake.ErrorResponder) - - // RegenerateKey is the fake for method AccountsClient.RegenerateKey - // HTTP status codes to indicate success: http.StatusOK - RegenerateKey func(ctx context.Context, resourceGroupName string, accountName string, regenerateKey armstorage.AccountRegenerateKeyParameters, options *armstorage.AccountsClientRegenerateKeyOptions) (resp azfake.Responder[armstorage.AccountsClientRegenerateKeyResponse], errResp azfake.ErrorResponder) - - // BeginRestoreBlobRanges is the fake for method AccountsClient.BeginRestoreBlobRanges - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginRestoreBlobRanges func(ctx context.Context, resourceGroupName string, accountName string, parameters armstorage.BlobRestoreParameters, options *armstorage.AccountsClientBeginRestoreBlobRangesOptions) (resp azfake.PollerResponder[armstorage.AccountsClientRestoreBlobRangesResponse], errResp azfake.ErrorResponder) - - // RevokeUserDelegationKeys is the fake for method AccountsClient.RevokeUserDelegationKeys - // HTTP status codes to indicate success: http.StatusOK - RevokeUserDelegationKeys func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.AccountsClientRevokeUserDelegationKeysOptions) (resp azfake.Responder[armstorage.AccountsClientRevokeUserDelegationKeysResponse], errResp azfake.ErrorResponder) - - // Update is the fake for method AccountsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, accountName string, parameters armstorage.AccountUpdateParameters, options *armstorage.AccountsClientUpdateOptions) (resp azfake.Responder[armstorage.AccountsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewAccountsServerTransport creates a new instance of AccountsServerTransport with the provided implementation. -// The returned AccountsServerTransport instance is connected to an instance of armstorage.AccountsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAccountsServerTransport(srv *AccountsServer) *AccountsServerTransport { - return &AccountsServerTransport{ - srv: srv, - beginAbortHierarchicalNamespaceMigration: newTracker[azfake.PollerResponder[armstorage.AccountsClientAbortHierarchicalNamespaceMigrationResponse]](), - beginCreate: newTracker[azfake.PollerResponder[armstorage.AccountsClientCreateResponse]](), - beginCustomerInitiatedMigration: newTracker[azfake.PollerResponder[armstorage.AccountsClientCustomerInitiatedMigrationResponse]](), - beginFailover: newTracker[azfake.PollerResponder[armstorage.AccountsClientFailoverResponse]](), - beginHierarchicalNamespaceMigration: newTracker[azfake.PollerResponder[armstorage.AccountsClientHierarchicalNamespaceMigrationResponse]](), - newListPager: newTracker[azfake.PagerResponder[armstorage.AccountsClientListResponse]](), - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armstorage.AccountsClientListByResourceGroupResponse]](), - beginRestoreBlobRanges: newTracker[azfake.PollerResponder[armstorage.AccountsClientRestoreBlobRangesResponse]](), - } -} - -// AccountsServerTransport connects instances of armstorage.AccountsClient to instances of AccountsServer. -// Don't use this type directly, use NewAccountsServerTransport instead. -type AccountsServerTransport struct { - srv *AccountsServer - beginAbortHierarchicalNamespaceMigration *tracker[azfake.PollerResponder[armstorage.AccountsClientAbortHierarchicalNamespaceMigrationResponse]] - beginCreate *tracker[azfake.PollerResponder[armstorage.AccountsClientCreateResponse]] - beginCustomerInitiatedMigration *tracker[azfake.PollerResponder[armstorage.AccountsClientCustomerInitiatedMigrationResponse]] - beginFailover *tracker[azfake.PollerResponder[armstorage.AccountsClientFailoverResponse]] - beginHierarchicalNamespaceMigration *tracker[azfake.PollerResponder[armstorage.AccountsClientHierarchicalNamespaceMigrationResponse]] - newListPager *tracker[azfake.PagerResponder[armstorage.AccountsClientListResponse]] - newListByResourceGroupPager *tracker[azfake.PagerResponder[armstorage.AccountsClientListByResourceGroupResponse]] - beginRestoreBlobRanges *tracker[azfake.PollerResponder[armstorage.AccountsClientRestoreBlobRangesResponse]] -} - -// Do implements the policy.Transporter interface for AccountsServerTransport. -func (a *AccountsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AccountsClient.BeginAbortHierarchicalNamespaceMigration": - resp, err = a.dispatchBeginAbortHierarchicalNamespaceMigration(req) - case "AccountsClient.CheckNameAvailability": - resp, err = a.dispatchCheckNameAvailability(req) - case "AccountsClient.BeginCreate": - resp, err = a.dispatchBeginCreate(req) - case "AccountsClient.BeginCustomerInitiatedMigration": - resp, err = a.dispatchBeginCustomerInitiatedMigration(req) - case "AccountsClient.Delete": - resp, err = a.dispatchDelete(req) - case "AccountsClient.BeginFailover": - resp, err = a.dispatchBeginFailover(req) - case "AccountsClient.GetCustomerInitiatedMigration": - resp, err = a.dispatchGetCustomerInitiatedMigration(req) - case "AccountsClient.GetProperties": - resp, err = a.dispatchGetProperties(req) - case "AccountsClient.BeginHierarchicalNamespaceMigration": - resp, err = a.dispatchBeginHierarchicalNamespaceMigration(req) - case "AccountsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - case "AccountsClient.ListAccountSAS": - resp, err = a.dispatchListAccountSAS(req) - case "AccountsClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AccountsClient.ListKeys": - resp, err = a.dispatchListKeys(req) - case "AccountsClient.ListServiceSAS": - resp, err = a.dispatchListServiceSAS(req) - case "AccountsClient.RegenerateKey": - resp, err = a.dispatchRegenerateKey(req) - case "AccountsClient.BeginRestoreBlobRanges": - resp, err = a.dispatchBeginRestoreBlobRanges(req) - case "AccountsClient.RevokeUserDelegationKeys": - resp, err = a.dispatchRevokeUserDelegationKeys(req) - case "AccountsClient.Update": - resp, err = a.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AccountsServerTransport) dispatchBeginAbortHierarchicalNamespaceMigration(req *http.Request) (*http.Response, error) { - if a.srv.BeginAbortHierarchicalNamespaceMigration == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginAbortHierarchicalNamespaceMigration not implemented")} - } - beginAbortHierarchicalNamespaceMigration := a.beginAbortHierarchicalNamespaceMigration.get(req) - if beginAbortHierarchicalNamespaceMigration == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/aborthnsonmigration` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginAbortHierarchicalNamespaceMigration(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginAbortHierarchicalNamespaceMigration = &respr - a.beginAbortHierarchicalNamespaceMigration.add(req, beginAbortHierarchicalNamespaceMigration) - } - - resp, err := server.PollerResponderNext(beginAbortHierarchicalNamespaceMigration, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - a.beginAbortHierarchicalNamespaceMigration.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginAbortHierarchicalNamespaceMigration) { - a.beginAbortHierarchicalNamespaceMigration.remove(req) - } - - return resp, nil -} - -func (a *AccountsServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { - if a.srv.CheckNameAvailability == nil { - return nil, &nonRetriableError{errors.New("fake for method CheckNameAvailability not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/checkNameAvailability` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.AccountCheckNameAvailabilityParameters](req) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.CheckNameAvailability(req.Context(), body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameAvailabilityResult, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AccountsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if a.srv.BeginCreate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} - } - beginCreate := a.beginCreate.get(req) - if beginCreate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.AccountCreateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginCreate(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreate = &respr - a.beginCreate.add(req, beginCreate) - } - - resp, err := server.PollerResponderNext(beginCreate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - a.beginCreate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreate) { - a.beginCreate.remove(req) - } - - return resp, nil -} - -func (a *AccountsServerTransport) dispatchBeginCustomerInitiatedMigration(req *http.Request) (*http.Response, error) { - if a.srv.BeginCustomerInitiatedMigration == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCustomerInitiatedMigration not implemented")} - } - beginCustomerInitiatedMigration := a.beginCustomerInitiatedMigration.get(req) - if beginCustomerInitiatedMigration == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/startAccountMigration` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.AccountMigration](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginCustomerInitiatedMigration(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCustomerInitiatedMigration = &respr - a.beginCustomerInitiatedMigration.add(req, beginCustomerInitiatedMigration) - } - - resp, err := server.PollerResponderNext(beginCustomerInitiatedMigration, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - a.beginCustomerInitiatedMigration.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCustomerInitiatedMigration) { - a.beginCustomerInitiatedMigration.remove(req) - } - - return resp, nil -} - -func (a *AccountsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if a.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AccountsServerTransport) dispatchBeginFailover(req *http.Request) (*http.Response, error) { - if a.srv.BeginFailover == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginFailover not implemented")} - } - beginFailover := a.beginFailover.get(req) - if beginFailover == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/failover` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - failoverTypeUnescaped, err := url.QueryUnescape(qp.Get("failoverType")) - if err != nil { - return nil, err - } - failoverTypeParam := getOptional(failoverTypeUnescaped) - var options *armstorage.AccountsClientBeginFailoverOptions - if failoverTypeParam != nil { - options = &armstorage.AccountsClientBeginFailoverOptions{ - FailoverType: failoverTypeParam, - } - } - respr, errRespr := a.srv.BeginFailover(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginFailover = &respr - a.beginFailover.add(req, beginFailover) - } - - resp, err := server.PollerResponderNext(beginFailover, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - a.beginFailover.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginFailover) { - a.beginFailover.remove(req) - } - - return resp, nil -} - -func (a *AccountsServerTransport) dispatchGetCustomerInitiatedMigration(req *http.Request) (*http.Response, error) { - if a.srv.GetCustomerInitiatedMigration == nil { - return nil, &nonRetriableError{errors.New("fake for method GetCustomerInitiatedMigration not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/accountMigrations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - migrationNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("migrationName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.GetCustomerInitiatedMigration(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, armstorage.MigrationName(migrationNameUnescaped), nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AccountMigration, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AccountsServerTransport) dispatchGetProperties(req *http.Request) (*http.Response, error) { - if a.srv.GetProperties == nil { - return nil, &nonRetriableError{errors.New("fake for method GetProperties not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) - if err != nil { - return nil, err - } - expandParam := getOptional(armstorage.StorageAccountExpand(expandUnescaped)) - var options *armstorage.AccountsClientGetPropertiesOptions - if expandParam != nil { - options = &armstorage.AccountsClientGetPropertiesOptions{ - Expand: expandParam, - } - } - respr, errRespr := a.srv.GetProperties(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Account, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AccountsServerTransport) dispatchBeginHierarchicalNamespaceMigration(req *http.Request) (*http.Response, error) { - if a.srv.BeginHierarchicalNamespaceMigration == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginHierarchicalNamespaceMigration not implemented")} - } - beginHierarchicalNamespaceMigration := a.beginHierarchicalNamespaceMigration.get(req) - if beginHierarchicalNamespaceMigration == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hnsonmigration` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - requestTypeUnescaped, err := url.QueryUnescape(qp.Get("requestType")) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginHierarchicalNamespaceMigration(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, requestTypeUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginHierarchicalNamespaceMigration = &respr - a.beginHierarchicalNamespaceMigration.add(req, beginHierarchicalNamespaceMigration) - } - - resp, err := server.PollerResponderNext(beginHierarchicalNamespaceMigration, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - a.beginHierarchicalNamespaceMigration.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginHierarchicalNamespaceMigration) { - a.beginHierarchicalNamespaceMigration.remove(req) - } - - return resp, nil -} - -func (a *AccountsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := a.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := a.srv.NewListPager(nil) - newListPager = &resp - a.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armstorage.AccountsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - a.newListPager.remove(req) - } - return resp, nil -} - -func (a *AccountsServerTransport) dispatchListAccountSAS(req *http.Request) (*http.Response, error) { - if a.srv.ListAccountSAS == nil { - return nil, &nonRetriableError{errors.New("fake for method ListAccountSAS not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ListAccountSas` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.AccountSasParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.ListAccountSAS(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ListAccountSasResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AccountsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := a.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByResourceGroupPager(resourceGroupNameUnescaped, nil) - newListByResourceGroupPager = &resp - a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armstorage.AccountsClientListByResourceGroupResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - a.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (a *AccountsServerTransport) dispatchListKeys(req *http.Request) (*http.Response, error) { - if a.srv.ListKeys == nil { - return nil, &nonRetriableError{errors.New("fake for method ListKeys not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listKeys` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) - if err != nil { - return nil, err - } - expandParam := getOptional(expandUnescaped) - var options *armstorage.AccountsClientListKeysOptions - if expandParam != nil { - options = &armstorage.AccountsClientListKeysOptions{ - Expand: expandParam, - } - } - respr, errRespr := a.srv.ListKeys(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AccountListKeysResult, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AccountsServerTransport) dispatchListServiceSAS(req *http.Request) (*http.Response, error) { - if a.srv.ListServiceSAS == nil { - return nil, &nonRetriableError{errors.New("fake for method ListServiceSAS not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ListServiceSas` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.ServiceSasParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.ListServiceSAS(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ListServiceSasResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AccountsServerTransport) dispatchRegenerateKey(req *http.Request) (*http.Response, error) { - if a.srv.RegenerateKey == nil { - return nil, &nonRetriableError{errors.New("fake for method RegenerateKey not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/regenerateKey` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.AccountRegenerateKeyParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.RegenerateKey(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AccountListKeysResult, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AccountsServerTransport) dispatchBeginRestoreBlobRanges(req *http.Request) (*http.Response, error) { - if a.srv.BeginRestoreBlobRanges == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginRestoreBlobRanges not implemented")} - } - beginRestoreBlobRanges := a.beginRestoreBlobRanges.get(req) - if beginRestoreBlobRanges == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/restoreBlobRanges` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.BlobRestoreParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginRestoreBlobRanges(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginRestoreBlobRanges = &respr - a.beginRestoreBlobRanges.add(req, beginRestoreBlobRanges) - } - - resp, err := server.PollerResponderNext(beginRestoreBlobRanges, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - a.beginRestoreBlobRanges.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginRestoreBlobRanges) { - a.beginRestoreBlobRanges.remove(req) - } - - return resp, nil -} - -func (a *AccountsServerTransport) dispatchRevokeUserDelegationKeys(req *http.Request) (*http.Response, error) { - if a.srv.RevokeUserDelegationKeys == nil { - return nil, &nonRetriableError{errors.New("fake for method RevokeUserDelegationKeys not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/revokeUserDelegationKeys` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.RevokeUserDelegationKeys(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AccountsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if a.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.AccountUpdateParameters](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Account, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/blobcontainers_server.go b/sdk/resourcemanager/storage/armstorage/fake/blobcontainers_server.go deleted file mode 100644 index 62bf8ea80f02..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/blobcontainers_server.go +++ /dev/null @@ -1,780 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// BlobContainersServer is a fake server for instances of the armstorage.BlobContainersClient type. -type BlobContainersServer struct { - // ClearLegalHold is the fake for method BlobContainersClient.ClearLegalHold - // HTTP status codes to indicate success: http.StatusOK - ClearLegalHold func(ctx context.Context, resourceGroupName string, accountName string, containerName string, legalHold armstorage.LegalHold, options *armstorage.BlobContainersClientClearLegalHoldOptions) (resp azfake.Responder[armstorage.BlobContainersClientClearLegalHoldResponse], errResp azfake.ErrorResponder) - - // Create is the fake for method BlobContainersClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, accountName string, containerName string, blobContainer armstorage.BlobContainer, options *armstorage.BlobContainersClientCreateOptions) (resp azfake.Responder[armstorage.BlobContainersClientCreateResponse], errResp azfake.ErrorResponder) - - // CreateOrUpdateImmutabilityPolicy is the fake for method BlobContainersClient.CreateOrUpdateImmutabilityPolicy - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdateImmutabilityPolicy func(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *armstorage.BlobContainersClientCreateOrUpdateImmutabilityPolicyOptions) (resp azfake.Responder[armstorage.BlobContainersClientCreateOrUpdateImmutabilityPolicyResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method BlobContainersClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *armstorage.BlobContainersClientDeleteOptions) (resp azfake.Responder[armstorage.BlobContainersClientDeleteResponse], errResp azfake.ErrorResponder) - - // DeleteImmutabilityPolicy is the fake for method BlobContainersClient.DeleteImmutabilityPolicy - // HTTP status codes to indicate success: http.StatusOK - DeleteImmutabilityPolicy func(ctx context.Context, resourceGroupName string, accountName string, containerName string, ifMatch string, options *armstorage.BlobContainersClientDeleteImmutabilityPolicyOptions) (resp azfake.Responder[armstorage.BlobContainersClientDeleteImmutabilityPolicyResponse], errResp azfake.ErrorResponder) - - // ExtendImmutabilityPolicy is the fake for method BlobContainersClient.ExtendImmutabilityPolicy - // HTTP status codes to indicate success: http.StatusOK - ExtendImmutabilityPolicy func(ctx context.Context, resourceGroupName string, accountName string, containerName string, ifMatch string, options *armstorage.BlobContainersClientExtendImmutabilityPolicyOptions) (resp azfake.Responder[armstorage.BlobContainersClientExtendImmutabilityPolicyResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method BlobContainersClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *armstorage.BlobContainersClientGetOptions) (resp azfake.Responder[armstorage.BlobContainersClientGetResponse], errResp azfake.ErrorResponder) - - // GetImmutabilityPolicy is the fake for method BlobContainersClient.GetImmutabilityPolicy - // HTTP status codes to indicate success: http.StatusOK - GetImmutabilityPolicy func(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *armstorage.BlobContainersClientGetImmutabilityPolicyOptions) (resp azfake.Responder[armstorage.BlobContainersClientGetImmutabilityPolicyResponse], errResp azfake.ErrorResponder) - - // Lease is the fake for method BlobContainersClient.Lease - // HTTP status codes to indicate success: http.StatusOK - Lease func(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *armstorage.BlobContainersClientLeaseOptions) (resp azfake.Responder[armstorage.BlobContainersClientLeaseResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method BlobContainersClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, accountName string, options *armstorage.BlobContainersClientListOptions) (resp azfake.PagerResponder[armstorage.BlobContainersClientListResponse]) - - // LockImmutabilityPolicy is the fake for method BlobContainersClient.LockImmutabilityPolicy - // HTTP status codes to indicate success: http.StatusOK - LockImmutabilityPolicy func(ctx context.Context, resourceGroupName string, accountName string, containerName string, ifMatch string, options *armstorage.BlobContainersClientLockImmutabilityPolicyOptions) (resp azfake.Responder[armstorage.BlobContainersClientLockImmutabilityPolicyResponse], errResp azfake.ErrorResponder) - - // BeginObjectLevelWorm is the fake for method BlobContainersClient.BeginObjectLevelWorm - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginObjectLevelWorm func(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *armstorage.BlobContainersClientBeginObjectLevelWormOptions) (resp azfake.PollerResponder[armstorage.BlobContainersClientObjectLevelWormResponse], errResp azfake.ErrorResponder) - - // SetLegalHold is the fake for method BlobContainersClient.SetLegalHold - // HTTP status codes to indicate success: http.StatusOK - SetLegalHold func(ctx context.Context, resourceGroupName string, accountName string, containerName string, legalHold armstorage.LegalHold, options *armstorage.BlobContainersClientSetLegalHoldOptions) (resp azfake.Responder[armstorage.BlobContainersClientSetLegalHoldResponse], errResp azfake.ErrorResponder) - - // Update is the fake for method BlobContainersClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, accountName string, containerName string, blobContainer armstorage.BlobContainer, options *armstorage.BlobContainersClientUpdateOptions) (resp azfake.Responder[armstorage.BlobContainersClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewBlobContainersServerTransport creates a new instance of BlobContainersServerTransport with the provided implementation. -// The returned BlobContainersServerTransport instance is connected to an instance of armstorage.BlobContainersClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBlobContainersServerTransport(srv *BlobContainersServer) *BlobContainersServerTransport { - return &BlobContainersServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armstorage.BlobContainersClientListResponse]](), - beginObjectLevelWorm: newTracker[azfake.PollerResponder[armstorage.BlobContainersClientObjectLevelWormResponse]](), - } -} - -// BlobContainersServerTransport connects instances of armstorage.BlobContainersClient to instances of BlobContainersServer. -// Don't use this type directly, use NewBlobContainersServerTransport instead. -type BlobContainersServerTransport struct { - srv *BlobContainersServer - newListPager *tracker[azfake.PagerResponder[armstorage.BlobContainersClientListResponse]] - beginObjectLevelWorm *tracker[azfake.PollerResponder[armstorage.BlobContainersClientObjectLevelWormResponse]] -} - -// Do implements the policy.Transporter interface for BlobContainersServerTransport. -func (b *BlobContainersServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BlobContainersClient.ClearLegalHold": - resp, err = b.dispatchClearLegalHold(req) - case "BlobContainersClient.Create": - resp, err = b.dispatchCreate(req) - case "BlobContainersClient.CreateOrUpdateImmutabilityPolicy": - resp, err = b.dispatchCreateOrUpdateImmutabilityPolicy(req) - case "BlobContainersClient.Delete": - resp, err = b.dispatchDelete(req) - case "BlobContainersClient.DeleteImmutabilityPolicy": - resp, err = b.dispatchDeleteImmutabilityPolicy(req) - case "BlobContainersClient.ExtendImmutabilityPolicy": - resp, err = b.dispatchExtendImmutabilityPolicy(req) - case "BlobContainersClient.Get": - resp, err = b.dispatchGet(req) - case "BlobContainersClient.GetImmutabilityPolicy": - resp, err = b.dispatchGetImmutabilityPolicy(req) - case "BlobContainersClient.Lease": - resp, err = b.dispatchLease(req) - case "BlobContainersClient.NewListPager": - resp, err = b.dispatchNewListPager(req) - case "BlobContainersClient.LockImmutabilityPolicy": - resp, err = b.dispatchLockImmutabilityPolicy(req) - case "BlobContainersClient.BeginObjectLevelWorm": - resp, err = b.dispatchBeginObjectLevelWorm(req) - case "BlobContainersClient.SetLegalHold": - resp, err = b.dispatchSetLegalHold(req) - case "BlobContainersClient.Update": - resp, err = b.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BlobContainersServerTransport) dispatchClearLegalHold(req *http.Request) (*http.Response, error) { - if b.srv.ClearLegalHold == nil { - return nil, &nonRetriableError{errors.New("fake for method ClearLegalHold not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices/default/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/clearLegalHold` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.LegalHold](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - containerNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.ClearLegalHold(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, containerNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LegalHold, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (b *BlobContainersServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if b.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices/default/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.BlobContainer](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - containerNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.Create(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, containerNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BlobContainer, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (b *BlobContainersServerTransport) dispatchCreateOrUpdateImmutabilityPolicy(req *http.Request) (*http.Response, error) { - if b.srv.CreateOrUpdateImmutabilityPolicy == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdateImmutabilityPolicy not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices/default/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/immutabilityPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.ImmutabilityPolicy](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - containerNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) - var options *armstorage.BlobContainersClientCreateOrUpdateImmutabilityPolicyOptions - if ifMatchParam != nil || !reflect.ValueOf(body).IsZero() { - options = &armstorage.BlobContainersClientCreateOrUpdateImmutabilityPolicyOptions{ - IfMatch: ifMatchParam, - Parameters: &body, - } - } - respr, errRespr := b.srv.CreateOrUpdateImmutabilityPolicy(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, containerNameUnescaped, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImmutabilityPolicy, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).ETag; val != nil { - resp.Header.Set("ETag", *val) - } - return resp, nil -} - -func (b *BlobContainersServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if b.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices/default/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - containerNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.Delete(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, containerNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (b *BlobContainersServerTransport) dispatchDeleteImmutabilityPolicy(req *http.Request) (*http.Response, error) { - if b.srv.DeleteImmutabilityPolicy == nil { - return nil, &nonRetriableError{errors.New("fake for method DeleteImmutabilityPolicy not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices/default/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/immutabilityPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - containerNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.DeleteImmutabilityPolicy(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, containerNameUnescaped, getHeaderValue(req.Header, "If-Match"), nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImmutabilityPolicy, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).ETag; val != nil { - resp.Header.Set("ETag", *val) - } - return resp, nil -} - -func (b *BlobContainersServerTransport) dispatchExtendImmutabilityPolicy(req *http.Request) (*http.Response, error) { - if b.srv.ExtendImmutabilityPolicy == nil { - return nil, &nonRetriableError{errors.New("fake for method ExtendImmutabilityPolicy not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices/default/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/immutabilityPolicies/default/extend` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.ImmutabilityPolicy](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - containerNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - var options *armstorage.BlobContainersClientExtendImmutabilityPolicyOptions - if !reflect.ValueOf(body).IsZero() { - options = &armstorage.BlobContainersClientExtendImmutabilityPolicyOptions{ - Parameters: &body, - } - } - respr, errRespr := b.srv.ExtendImmutabilityPolicy(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, containerNameUnescaped, getHeaderValue(req.Header, "If-Match"), options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImmutabilityPolicy, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).ETag; val != nil { - resp.Header.Set("ETag", *val) - } - return resp, nil -} - -func (b *BlobContainersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if b.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices/default/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - containerNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.Get(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, containerNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BlobContainer, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (b *BlobContainersServerTransport) dispatchGetImmutabilityPolicy(req *http.Request) (*http.Response, error) { - if b.srv.GetImmutabilityPolicy == nil { - return nil, &nonRetriableError{errors.New("fake for method GetImmutabilityPolicy not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices/default/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/immutabilityPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - containerNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) - var options *armstorage.BlobContainersClientGetImmutabilityPolicyOptions - if ifMatchParam != nil { - options = &armstorage.BlobContainersClientGetImmutabilityPolicyOptions{ - IfMatch: ifMatchParam, - } - } - respr, errRespr := b.srv.GetImmutabilityPolicy(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, containerNameUnescaped, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImmutabilityPolicy, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).ETag; val != nil { - resp.Header.Set("ETag", *val) - } - return resp, nil -} - -func (b *BlobContainersServerTransport) dispatchLease(req *http.Request) (*http.Response, error) { - if b.srv.Lease == nil { - return nil, &nonRetriableError{errors.New("fake for method Lease not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices/default/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/lease` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.LeaseContainerRequest](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - containerNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - var options *armstorage.BlobContainersClientLeaseOptions - if !reflect.ValueOf(body).IsZero() { - options = &armstorage.BlobContainersClientLeaseOptions{ - Parameters: &body, - } - } - respr, errRespr := b.srv.Lease(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, containerNameUnescaped, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LeaseContainerResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (b *BlobContainersServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if b.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := b.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices/default/containers` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - maxpagesizeUnescaped, err := url.QueryUnescape(qp.Get("$maxpagesize")) - if err != nil { - return nil, err - } - maxpagesizeParam := getOptional(maxpagesizeUnescaped) - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - includeUnescaped, err := url.QueryUnescape(qp.Get("$include")) - if err != nil { - return nil, err - } - includeParam := getOptional(armstorage.ListContainersInclude(includeUnescaped)) - var options *armstorage.BlobContainersClientListOptions - if maxpagesizeParam != nil || filterParam != nil || includeParam != nil { - options = &armstorage.BlobContainersClientListOptions{ - Maxpagesize: maxpagesizeParam, - Filter: filterParam, - Include: includeParam, - } - } - resp := b.srv.NewListPager(resourceGroupNameUnescaped, accountNameUnescaped, options) - newListPager = &resp - b.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armstorage.BlobContainersClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - b.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - b.newListPager.remove(req) - } - return resp, nil -} - -func (b *BlobContainersServerTransport) dispatchLockImmutabilityPolicy(req *http.Request) (*http.Response, error) { - if b.srv.LockImmutabilityPolicy == nil { - return nil, &nonRetriableError{errors.New("fake for method LockImmutabilityPolicy not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices/default/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/immutabilityPolicies/default/lock` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - containerNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.LockImmutabilityPolicy(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, containerNameUnescaped, getHeaderValue(req.Header, "If-Match"), nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ImmutabilityPolicy, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).ETag; val != nil { - resp.Header.Set("ETag", *val) - } - return resp, nil -} - -func (b *BlobContainersServerTransport) dispatchBeginObjectLevelWorm(req *http.Request) (*http.Response, error) { - if b.srv.BeginObjectLevelWorm == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginObjectLevelWorm not implemented")} - } - beginObjectLevelWorm := b.beginObjectLevelWorm.get(req) - if beginObjectLevelWorm == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices/default/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/migrate` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - containerNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.BeginObjectLevelWorm(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, containerNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginObjectLevelWorm = &respr - b.beginObjectLevelWorm.add(req, beginObjectLevelWorm) - } - - resp, err := server.PollerResponderNext(beginObjectLevelWorm, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - b.beginObjectLevelWorm.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginObjectLevelWorm) { - b.beginObjectLevelWorm.remove(req) - } - - return resp, nil -} - -func (b *BlobContainersServerTransport) dispatchSetLegalHold(req *http.Request) (*http.Response, error) { - if b.srv.SetLegalHold == nil { - return nil, &nonRetriableError{errors.New("fake for method SetLegalHold not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices/default/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/setLegalHold` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.LegalHold](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - containerNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.SetLegalHold(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, containerNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LegalHold, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (b *BlobContainersServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if b.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices/default/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.BlobContainer](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - containerNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.Update(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, containerNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BlobContainer, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/blobinventorypolicies_server.go b/sdk/resourcemanager/storage/armstorage/fake/blobinventorypolicies_server.go deleted file mode 100644 index 380f4c6e45cd..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/blobinventorypolicies_server.go +++ /dev/null @@ -1,242 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "regexp" -) - -// BlobInventoryPoliciesServer is a fake server for instances of the armstorage.BlobInventoryPoliciesClient type. -type BlobInventoryPoliciesServer struct { - // CreateOrUpdate is the fake for method BlobInventoryPoliciesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName armstorage.BlobInventoryPolicyName, properties armstorage.BlobInventoryPolicy, options *armstorage.BlobInventoryPoliciesClientCreateOrUpdateOptions) (resp azfake.Responder[armstorage.BlobInventoryPoliciesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method BlobInventoryPoliciesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName armstorage.BlobInventoryPolicyName, options *armstorage.BlobInventoryPoliciesClientDeleteOptions) (resp azfake.Responder[armstorage.BlobInventoryPoliciesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method BlobInventoryPoliciesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, accountName string, blobInventoryPolicyName armstorage.BlobInventoryPolicyName, options *armstorage.BlobInventoryPoliciesClientGetOptions) (resp azfake.Responder[armstorage.BlobInventoryPoliciesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method BlobInventoryPoliciesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, accountName string, options *armstorage.BlobInventoryPoliciesClientListOptions) (resp azfake.PagerResponder[armstorage.BlobInventoryPoliciesClientListResponse]) -} - -// NewBlobInventoryPoliciesServerTransport creates a new instance of BlobInventoryPoliciesServerTransport with the provided implementation. -// The returned BlobInventoryPoliciesServerTransport instance is connected to an instance of armstorage.BlobInventoryPoliciesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBlobInventoryPoliciesServerTransport(srv *BlobInventoryPoliciesServer) *BlobInventoryPoliciesServerTransport { - return &BlobInventoryPoliciesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armstorage.BlobInventoryPoliciesClientListResponse]](), - } -} - -// BlobInventoryPoliciesServerTransport connects instances of armstorage.BlobInventoryPoliciesClient to instances of BlobInventoryPoliciesServer. -// Don't use this type directly, use NewBlobInventoryPoliciesServerTransport instead. -type BlobInventoryPoliciesServerTransport struct { - srv *BlobInventoryPoliciesServer - newListPager *tracker[azfake.PagerResponder[armstorage.BlobInventoryPoliciesClientListResponse]] -} - -// Do implements the policy.Transporter interface for BlobInventoryPoliciesServerTransport. -func (b *BlobInventoryPoliciesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BlobInventoryPoliciesClient.CreateOrUpdate": - resp, err = b.dispatchCreateOrUpdate(req) - case "BlobInventoryPoliciesClient.Delete": - resp, err = b.dispatchDelete(req) - case "BlobInventoryPoliciesClient.Get": - resp, err = b.dispatchGet(req) - case "BlobInventoryPoliciesClient.NewListPager": - resp, err = b.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BlobInventoryPoliciesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if b.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/inventoryPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.BlobInventoryPolicy](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - blobInventoryPolicyNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("blobInventoryPolicyName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.CreateOrUpdate(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, armstorage.BlobInventoryPolicyName(blobInventoryPolicyNameUnescaped), body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BlobInventoryPolicy, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (b *BlobInventoryPoliciesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if b.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/inventoryPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - blobInventoryPolicyNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("blobInventoryPolicyName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.Delete(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, armstorage.BlobInventoryPolicyName(blobInventoryPolicyNameUnescaped), nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (b *BlobInventoryPoliciesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if b.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/inventoryPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - blobInventoryPolicyNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("blobInventoryPolicyName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.Get(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, armstorage.BlobInventoryPolicyName(blobInventoryPolicyNameUnescaped), nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BlobInventoryPolicy, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (b *BlobInventoryPoliciesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if b.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := b.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/inventoryPolicies` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - resp := b.srv.NewListPager(resourceGroupNameUnescaped, accountNameUnescaped, nil) - newListPager = &resp - b.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - b.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - b.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/blobservices_server.go b/sdk/resourcemanager/storage/armstorage/fake/blobservices_server.go deleted file mode 100644 index 07cd8d163b65..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/blobservices_server.go +++ /dev/null @@ -1,191 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "regexp" -) - -// BlobServicesServer is a fake server for instances of the armstorage.BlobServicesClient type. -type BlobServicesServer struct { - // GetServiceProperties is the fake for method BlobServicesClient.GetServiceProperties - // HTTP status codes to indicate success: http.StatusOK - GetServiceProperties func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.BlobServicesClientGetServicePropertiesOptions) (resp azfake.Responder[armstorage.BlobServicesClientGetServicePropertiesResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method BlobServicesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, accountName string, options *armstorage.BlobServicesClientListOptions) (resp azfake.PagerResponder[armstorage.BlobServicesClientListResponse]) - - // SetServiceProperties is the fake for method BlobServicesClient.SetServiceProperties - // HTTP status codes to indicate success: http.StatusOK - SetServiceProperties func(ctx context.Context, resourceGroupName string, accountName string, parameters armstorage.BlobServiceProperties, options *armstorage.BlobServicesClientSetServicePropertiesOptions) (resp azfake.Responder[armstorage.BlobServicesClientSetServicePropertiesResponse], errResp azfake.ErrorResponder) -} - -// NewBlobServicesServerTransport creates a new instance of BlobServicesServerTransport with the provided implementation. -// The returned BlobServicesServerTransport instance is connected to an instance of armstorage.BlobServicesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBlobServicesServerTransport(srv *BlobServicesServer) *BlobServicesServerTransport { - return &BlobServicesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armstorage.BlobServicesClientListResponse]](), - } -} - -// BlobServicesServerTransport connects instances of armstorage.BlobServicesClient to instances of BlobServicesServer. -// Don't use this type directly, use NewBlobServicesServerTransport instead. -type BlobServicesServerTransport struct { - srv *BlobServicesServer - newListPager *tracker[azfake.PagerResponder[armstorage.BlobServicesClientListResponse]] -} - -// Do implements the policy.Transporter interface for BlobServicesServerTransport. -func (b *BlobServicesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BlobServicesClient.GetServiceProperties": - resp, err = b.dispatchGetServiceProperties(req) - case "BlobServicesClient.NewListPager": - resp, err = b.dispatchNewListPager(req) - case "BlobServicesClient.SetServiceProperties": - resp, err = b.dispatchSetServiceProperties(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BlobServicesServerTransport) dispatchGetServiceProperties(req *http.Request) (*http.Response, error) { - if b.srv.GetServiceProperties == nil { - return nil, &nonRetriableError{errors.New("fake for method GetServiceProperties not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.GetServiceProperties(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BlobServiceProperties, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (b *BlobServicesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if b.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := b.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - resp := b.srv.NewListPager(resourceGroupNameUnescaped, accountNameUnescaped, nil) - newListPager = &resp - b.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - b.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - b.newListPager.remove(req) - } - return resp, nil -} - -func (b *BlobServicesServerTransport) dispatchSetServiceProperties(req *http.Request) (*http.Response, error) { - if b.srv.SetServiceProperties == nil { - return nil, &nonRetriableError{errors.New("fake for method SetServiceProperties not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/blobServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.BlobServiceProperties](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.SetServiceProperties(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BlobServiceProperties, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/deletedaccounts_server.go b/sdk/resourcemanager/storage/armstorage/fake/deletedaccounts_server.go deleted file mode 100644 index d33c3f532594..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/deletedaccounts_server.go +++ /dev/null @@ -1,144 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "regexp" -) - -// DeletedAccountsServer is a fake server for instances of the armstorage.DeletedAccountsClient type. -type DeletedAccountsServer struct { - // Get is the fake for method DeletedAccountsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, deletedAccountName string, location string, options *armstorage.DeletedAccountsClientGetOptions) (resp azfake.Responder[armstorage.DeletedAccountsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method DeletedAccountsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armstorage.DeletedAccountsClientListOptions) (resp azfake.PagerResponder[armstorage.DeletedAccountsClientListResponse]) -} - -// NewDeletedAccountsServerTransport creates a new instance of DeletedAccountsServerTransport with the provided implementation. -// The returned DeletedAccountsServerTransport instance is connected to an instance of armstorage.DeletedAccountsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDeletedAccountsServerTransport(srv *DeletedAccountsServer) *DeletedAccountsServerTransport { - return &DeletedAccountsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armstorage.DeletedAccountsClientListResponse]](), - } -} - -// DeletedAccountsServerTransport connects instances of armstorage.DeletedAccountsClient to instances of DeletedAccountsServer. -// Don't use this type directly, use NewDeletedAccountsServerTransport instead. -type DeletedAccountsServerTransport struct { - srv *DeletedAccountsServer - newListPager *tracker[azfake.PagerResponder[armstorage.DeletedAccountsClientListResponse]] -} - -// Do implements the policy.Transporter interface for DeletedAccountsServerTransport. -func (d *DeletedAccountsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "DeletedAccountsClient.Get": - resp, err = d.dispatchGet(req) - case "DeletedAccountsClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DeletedAccountsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/deletedAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - deletedAccountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("deletedAccountName")]) - if err != nil { - return nil, err - } - locationUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), deletedAccountNameUnescaped, locationUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DeletedAccount, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DeletedAccountsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := d.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/deletedAccounts` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := d.srv.NewListPager(nil) - newListPager = &resp - d.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armstorage.DeletedAccountsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - d.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/encryptionscopes_server.go b/sdk/resourcemanager/storage/armstorage/fake/encryptionscopes_server.go deleted file mode 100644 index 38844ccdb0f3..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/encryptionscopes_server.go +++ /dev/null @@ -1,284 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "regexp" - "strconv" -) - -// EncryptionScopesServer is a fake server for instances of the armstorage.EncryptionScopesClient type. -type EncryptionScopesServer struct { - // Get is the fake for method EncryptionScopesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, options *armstorage.EncryptionScopesClientGetOptions) (resp azfake.Responder[armstorage.EncryptionScopesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method EncryptionScopesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, accountName string, options *armstorage.EncryptionScopesClientListOptions) (resp azfake.PagerResponder[armstorage.EncryptionScopesClientListResponse]) - - // Patch is the fake for method EncryptionScopesClient.Patch - // HTTP status codes to indicate success: http.StatusOK - Patch func(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, encryptionScope armstorage.EncryptionScope, options *armstorage.EncryptionScopesClientPatchOptions) (resp azfake.Responder[armstorage.EncryptionScopesClientPatchResponse], errResp azfake.ErrorResponder) - - // Put is the fake for method EncryptionScopesClient.Put - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Put func(ctx context.Context, resourceGroupName string, accountName string, encryptionScopeName string, encryptionScope armstorage.EncryptionScope, options *armstorage.EncryptionScopesClientPutOptions) (resp azfake.Responder[armstorage.EncryptionScopesClientPutResponse], errResp azfake.ErrorResponder) -} - -// NewEncryptionScopesServerTransport creates a new instance of EncryptionScopesServerTransport with the provided implementation. -// The returned EncryptionScopesServerTransport instance is connected to an instance of armstorage.EncryptionScopesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewEncryptionScopesServerTransport(srv *EncryptionScopesServer) *EncryptionScopesServerTransport { - return &EncryptionScopesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armstorage.EncryptionScopesClientListResponse]](), - } -} - -// EncryptionScopesServerTransport connects instances of armstorage.EncryptionScopesClient to instances of EncryptionScopesServer. -// Don't use this type directly, use NewEncryptionScopesServerTransport instead. -type EncryptionScopesServerTransport struct { - srv *EncryptionScopesServer - newListPager *tracker[azfake.PagerResponder[armstorage.EncryptionScopesClientListResponse]] -} - -// Do implements the policy.Transporter interface for EncryptionScopesServerTransport. -func (e *EncryptionScopesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "EncryptionScopesClient.Get": - resp, err = e.dispatchGet(req) - case "EncryptionScopesClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - case "EncryptionScopesClient.Patch": - resp, err = e.dispatchPatch(req) - case "EncryptionScopesClient.Put": - resp, err = e.dispatchPut(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (e *EncryptionScopesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if e.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/encryptionScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - encryptionScopeNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("encryptionScopeName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, encryptionScopeNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EncryptionScope, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *EncryptionScopesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if e.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := e.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/encryptionScopes` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - maxpagesizeUnescaped, err := url.QueryUnescape(qp.Get("$maxpagesize")) - if err != nil { - return nil, err - } - maxpagesizeParam, err := parseOptional(maxpagesizeUnescaped, func(v string) (int32, error) { - p, parseErr := strconv.ParseInt(v, 10, 32) - if parseErr != nil { - return 0, parseErr - } - return int32(p), nil - }) - if err != nil { - return nil, err - } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - includeUnescaped, err := url.QueryUnescape(qp.Get("$include")) - if err != nil { - return nil, err - } - includeParam := getOptional(armstorage.ListEncryptionScopesInclude(includeUnescaped)) - var options *armstorage.EncryptionScopesClientListOptions - if maxpagesizeParam != nil || filterParam != nil || includeParam != nil { - options = &armstorage.EncryptionScopesClientListOptions{ - Maxpagesize: maxpagesizeParam, - Filter: filterParam, - Include: includeParam, - } - } - resp := e.srv.NewListPager(resourceGroupNameUnescaped, accountNameUnescaped, options) - newListPager = &resp - e.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armstorage.EncryptionScopesClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - e.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - e.newListPager.remove(req) - } - return resp, nil -} - -func (e *EncryptionScopesServerTransport) dispatchPatch(req *http.Request) (*http.Response, error) { - if e.srv.Patch == nil { - return nil, &nonRetriableError{errors.New("fake for method Patch not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/encryptionScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.EncryptionScope](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - encryptionScopeNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("encryptionScopeName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Patch(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, encryptionScopeNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EncryptionScope, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *EncryptionScopesServerTransport) dispatchPut(req *http.Request) (*http.Response, error) { - if e.srv.Put == nil { - return nil, &nonRetriableError{errors.New("fake for method Put not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/encryptionScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.EncryptionScope](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - encryptionScopeNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("encryptionScopeName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Put(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, encryptionScopeNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EncryptionScope, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/fileservices_server.go b/sdk/resourcemanager/storage/armstorage/fake/fileservices_server.go deleted file mode 100644 index 75ea54517283..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/fileservices_server.go +++ /dev/null @@ -1,182 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "regexp" -) - -// FileServicesServer is a fake server for instances of the armstorage.FileServicesClient type. -type FileServicesServer struct { - // GetServiceProperties is the fake for method FileServicesClient.GetServiceProperties - // HTTP status codes to indicate success: http.StatusOK - GetServiceProperties func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.FileServicesClientGetServicePropertiesOptions) (resp azfake.Responder[armstorage.FileServicesClientGetServicePropertiesResponse], errResp azfake.ErrorResponder) - - // List is the fake for method FileServicesClient.List - // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.FileServicesClientListOptions) (resp azfake.Responder[armstorage.FileServicesClientListResponse], errResp azfake.ErrorResponder) - - // SetServiceProperties is the fake for method FileServicesClient.SetServiceProperties - // HTTP status codes to indicate success: http.StatusOK - SetServiceProperties func(ctx context.Context, resourceGroupName string, accountName string, parameters armstorage.FileServiceProperties, options *armstorage.FileServicesClientSetServicePropertiesOptions) (resp azfake.Responder[armstorage.FileServicesClientSetServicePropertiesResponse], errResp azfake.ErrorResponder) -} - -// NewFileServicesServerTransport creates a new instance of FileServicesServerTransport with the provided implementation. -// The returned FileServicesServerTransport instance is connected to an instance of armstorage.FileServicesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewFileServicesServerTransport(srv *FileServicesServer) *FileServicesServerTransport { - return &FileServicesServerTransport{srv: srv} -} - -// FileServicesServerTransport connects instances of armstorage.FileServicesClient to instances of FileServicesServer. -// Don't use this type directly, use NewFileServicesServerTransport instead. -type FileServicesServerTransport struct { - srv *FileServicesServer -} - -// Do implements the policy.Transporter interface for FileServicesServerTransport. -func (f *FileServicesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "FileServicesClient.GetServiceProperties": - resp, err = f.dispatchGetServiceProperties(req) - case "FileServicesClient.List": - resp, err = f.dispatchList(req) - case "FileServicesClient.SetServiceProperties": - resp, err = f.dispatchSetServiceProperties(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (f *FileServicesServerTransport) dispatchGetServiceProperties(req *http.Request) (*http.Response, error) { - if f.srv.GetServiceProperties == nil { - return nil, &nonRetriableError{errors.New("fake for method GetServiceProperties not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fileServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := f.srv.GetServiceProperties(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FileServiceProperties, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (f *FileServicesServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if f.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fileServices` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := f.srv.List(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FileServiceItems, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (f *FileServicesServerTransport) dispatchSetServiceProperties(req *http.Request) (*http.Response, error) { - if f.srv.SetServiceProperties == nil { - return nil, &nonRetriableError{errors.New("fake for method SetServiceProperties not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fileServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.FileServiceProperties](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := f.srv.SetServiceProperties(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FileServiceProperties, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/fileshares_server.go b/sdk/resourcemanager/storage/armstorage/fake/fileshares_server.go deleted file mode 100644 index 3ce95bf4c45e..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/fileshares_server.go +++ /dev/null @@ -1,463 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// FileSharesServer is a fake server for instances of the armstorage.FileSharesClient type. -type FileSharesServer struct { - // Create is the fake for method FileSharesClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, accountName string, shareName string, fileShare armstorage.FileShare, options *armstorage.FileSharesClientCreateOptions) (resp azfake.Responder[armstorage.FileSharesClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method FileSharesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *armstorage.FileSharesClientDeleteOptions) (resp azfake.Responder[armstorage.FileSharesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method FileSharesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *armstorage.FileSharesClientGetOptions) (resp azfake.Responder[armstorage.FileSharesClientGetResponse], errResp azfake.ErrorResponder) - - // Lease is the fake for method FileSharesClient.Lease - // HTTP status codes to indicate success: http.StatusOK - Lease func(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *armstorage.FileSharesClientLeaseOptions) (resp azfake.Responder[armstorage.FileSharesClientLeaseResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method FileSharesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, accountName string, options *armstorage.FileSharesClientListOptions) (resp azfake.PagerResponder[armstorage.FileSharesClientListResponse]) - - // Restore is the fake for method FileSharesClient.Restore - // HTTP status codes to indicate success: http.StatusOK - Restore func(ctx context.Context, resourceGroupName string, accountName string, shareName string, deletedShare armstorage.DeletedShare, options *armstorage.FileSharesClientRestoreOptions) (resp azfake.Responder[armstorage.FileSharesClientRestoreResponse], errResp azfake.ErrorResponder) - - // Update is the fake for method FileSharesClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, accountName string, shareName string, fileShare armstorage.FileShare, options *armstorage.FileSharesClientUpdateOptions) (resp azfake.Responder[armstorage.FileSharesClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewFileSharesServerTransport creates a new instance of FileSharesServerTransport with the provided implementation. -// The returned FileSharesServerTransport instance is connected to an instance of armstorage.FileSharesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewFileSharesServerTransport(srv *FileSharesServer) *FileSharesServerTransport { - return &FileSharesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armstorage.FileSharesClientListResponse]](), - } -} - -// FileSharesServerTransport connects instances of armstorage.FileSharesClient to instances of FileSharesServer. -// Don't use this type directly, use NewFileSharesServerTransport instead. -type FileSharesServerTransport struct { - srv *FileSharesServer - newListPager *tracker[azfake.PagerResponder[armstorage.FileSharesClientListResponse]] -} - -// Do implements the policy.Transporter interface for FileSharesServerTransport. -func (f *FileSharesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "FileSharesClient.Create": - resp, err = f.dispatchCreate(req) - case "FileSharesClient.Delete": - resp, err = f.dispatchDelete(req) - case "FileSharesClient.Get": - resp, err = f.dispatchGet(req) - case "FileSharesClient.Lease": - resp, err = f.dispatchLease(req) - case "FileSharesClient.NewListPager": - resp, err = f.dispatchNewListPager(req) - case "FileSharesClient.Restore": - resp, err = f.dispatchRestore(req) - case "FileSharesClient.Update": - resp, err = f.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (f *FileSharesServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if f.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fileServices/default/shares/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - body, err := server.UnmarshalRequestAsJSON[armstorage.FileShare](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - shareNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("shareName")]) - if err != nil { - return nil, err - } - expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) - if err != nil { - return nil, err - } - expandParam := getOptional(expandUnescaped) - var options *armstorage.FileSharesClientCreateOptions - if expandParam != nil { - options = &armstorage.FileSharesClientCreateOptions{ - Expand: expandParam, - } - } - respr, errRespr := f.srv.Create(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, shareNameUnescaped, body, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FileShare, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (f *FileSharesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if f.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fileServices/default/shares/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - shareNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("shareName")]) - if err != nil { - return nil, err - } - xMSSnapshotParam := getOptional(getHeaderValue(req.Header, "x-ms-snapshot")) - includeUnescaped, err := url.QueryUnescape(qp.Get("$include")) - if err != nil { - return nil, err - } - includeParam := getOptional(includeUnescaped) - var options *armstorage.FileSharesClientDeleteOptions - if xMSSnapshotParam != nil || includeParam != nil { - options = &armstorage.FileSharesClientDeleteOptions{ - XMSSnapshot: xMSSnapshotParam, - Include: includeParam, - } - } - respr, errRespr := f.srv.Delete(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, shareNameUnescaped, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (f *FileSharesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if f.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fileServices/default/shares/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - shareNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("shareName")]) - if err != nil { - return nil, err - } - expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) - if err != nil { - return nil, err - } - expandParam := getOptional(expandUnescaped) - xMSSnapshotParam := getOptional(getHeaderValue(req.Header, "x-ms-snapshot")) - var options *armstorage.FileSharesClientGetOptions - if expandParam != nil || xMSSnapshotParam != nil { - options = &armstorage.FileSharesClientGetOptions{ - Expand: expandParam, - XMSSnapshot: xMSSnapshotParam, - } - } - respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, shareNameUnescaped, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FileShare, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (f *FileSharesServerTransport) dispatchLease(req *http.Request) (*http.Response, error) { - if f.srv.Lease == nil { - return nil, &nonRetriableError{errors.New("fake for method Lease not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fileServices/default/shares/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/lease` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.LeaseShareRequest](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - shareNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("shareName")]) - if err != nil { - return nil, err - } - xMSSnapshotParam := getOptional(getHeaderValue(req.Header, "x-ms-snapshot")) - var options *armstorage.FileSharesClientLeaseOptions - if xMSSnapshotParam != nil || !reflect.ValueOf(body).IsZero() { - options = &armstorage.FileSharesClientLeaseOptions{ - XMSSnapshot: xMSSnapshotParam, - Parameters: &body, - } - } - respr, errRespr := f.srv.Lease(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, shareNameUnescaped, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LeaseShareResponse, req) - if err != nil { - return nil, err - } - if val := server.GetResponse(respr).ETag; val != nil { - resp.Header.Set("ETag", *val) - } - return resp, nil -} - -func (f *FileSharesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if f.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := f.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fileServices/default/shares` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - maxpagesizeUnescaped, err := url.QueryUnescape(qp.Get("$maxpagesize")) - if err != nil { - return nil, err - } - maxpagesizeParam := getOptional(maxpagesizeUnescaped) - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) - if err != nil { - return nil, err - } - expandParam := getOptional(expandUnescaped) - var options *armstorage.FileSharesClientListOptions - if maxpagesizeParam != nil || filterParam != nil || expandParam != nil { - options = &armstorage.FileSharesClientListOptions{ - Maxpagesize: maxpagesizeParam, - Filter: filterParam, - Expand: expandParam, - } - } - resp := f.srv.NewListPager(resourceGroupNameUnescaped, accountNameUnescaped, options) - newListPager = &resp - f.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armstorage.FileSharesClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - f.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - f.newListPager.remove(req) - } - return resp, nil -} - -func (f *FileSharesServerTransport) dispatchRestore(req *http.Request) (*http.Response, error) { - if f.srv.Restore == nil { - return nil, &nonRetriableError{errors.New("fake for method Restore not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fileServices/default/shares/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/restore` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.DeletedShare](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - shareNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("shareName")]) - if err != nil { - return nil, err - } - respr, errRespr := f.srv.Restore(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, shareNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (f *FileSharesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if f.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fileServices/default/shares/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.FileShare](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - shareNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("shareName")]) - if err != nil { - return nil, err - } - respr, errRespr := f.srv.Update(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, shareNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FileShare, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/internal.go b/sdk/resourcemanager/storage/armstorage/fake/internal.go deleted file mode 100644 index 03b635903572..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/internal.go +++ /dev/null @@ -1,123 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "io" - "net/http" - "reflect" - "regexp" - "strings" - "sync" -) - -type nonRetriableError struct { - error -} - -func (nonRetriableError) NonRetriable() { - // marker method -} - -func getOptional[T any](v T) *T { - if reflect.ValueOf(v).IsZero() { - return nil - } - return &v -} - -func getHeaderValue(h http.Header, k string) string { - v := h[k] - if len(v) == 0 { - return "" - } - return v[0] -} - -func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { - if v == "" { - return nil, nil - } - t, err := parse(v) - if err != nil { - return nil, err - } - return &t, err -} - -func parseWithCast[T any](v string, parse func(v string) (T, error)) (T, error) { - t, err := parse(v) - if err != nil { - return *new(T), err - } - return t, err -} - -func readRequestBody(req *http.Request) ([]byte, error) { - if req.Body == nil { - return nil, nil - } - body, err := io.ReadAll(req.Body) - if err != nil { - return nil, err - } - req.Body.Close() - return body, nil -} - -func contains[T comparable](s []T, v T) bool { - for _, vv := range s { - if vv == v { - return true - } - } - return false -} - -func newTracker[T any]() *tracker[T] { - return &tracker[T]{ - items: map[string]*T{}, - } -} - -type tracker[T any] struct { - items map[string]*T - mu sync.Mutex -} - -func (p *tracker[T]) key(req *http.Request) string { - path := req.URL.Path - if match, _ := regexp.Match(`/page_\d+$`, []byte(path)); match { - path = path[:strings.LastIndex(path, "/")] - } else if strings.HasSuffix(path, "/get/fake/status") { - path = path[:len(path)-16] - } - return path -} - -func (p *tracker[T]) get(req *http.Request) *T { - p.mu.Lock() - defer p.mu.Unlock() - if item, ok := p.items[p.key(req)]; ok { - return item - } - return nil -} - -func (p *tracker[T]) add(req *http.Request, item *T) { - p.mu.Lock() - defer p.mu.Unlock() - p.items[p.key(req)] = item -} - -func (p *tracker[T]) remove(req *http.Request) { - p.mu.Lock() - defer p.mu.Unlock() - delete(p.items, p.key(req)) -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/localusers_server.go b/sdk/resourcemanager/storage/armstorage/fake/localusers_server.go deleted file mode 100644 index 18cbffd31e91..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/localusers_server.go +++ /dev/null @@ -1,328 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "regexp" -) - -// LocalUsersServer is a fake server for instances of the armstorage.LocalUsersClient type. -type LocalUsersServer struct { - // CreateOrUpdate is the fake for method LocalUsersClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceGroupName string, accountName string, username string, properties armstorage.LocalUser, options *armstorage.LocalUsersClientCreateOrUpdateOptions) (resp azfake.Responder[armstorage.LocalUsersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method LocalUsersClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, accountName string, username string, options *armstorage.LocalUsersClientDeleteOptions) (resp azfake.Responder[armstorage.LocalUsersClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method LocalUsersClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, accountName string, username string, options *armstorage.LocalUsersClientGetOptions) (resp azfake.Responder[armstorage.LocalUsersClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method LocalUsersClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, accountName string, options *armstorage.LocalUsersClientListOptions) (resp azfake.PagerResponder[armstorage.LocalUsersClientListResponse]) - - // ListKeys is the fake for method LocalUsersClient.ListKeys - // HTTP status codes to indicate success: http.StatusOK - ListKeys func(ctx context.Context, resourceGroupName string, accountName string, username string, options *armstorage.LocalUsersClientListKeysOptions) (resp azfake.Responder[armstorage.LocalUsersClientListKeysResponse], errResp azfake.ErrorResponder) - - // RegeneratePassword is the fake for method LocalUsersClient.RegeneratePassword - // HTTP status codes to indicate success: http.StatusOK - RegeneratePassword func(ctx context.Context, resourceGroupName string, accountName string, username string, options *armstorage.LocalUsersClientRegeneratePasswordOptions) (resp azfake.Responder[armstorage.LocalUsersClientRegeneratePasswordResponse], errResp azfake.ErrorResponder) -} - -// NewLocalUsersServerTransport creates a new instance of LocalUsersServerTransport with the provided implementation. -// The returned LocalUsersServerTransport instance is connected to an instance of armstorage.LocalUsersClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewLocalUsersServerTransport(srv *LocalUsersServer) *LocalUsersServerTransport { - return &LocalUsersServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armstorage.LocalUsersClientListResponse]](), - } -} - -// LocalUsersServerTransport connects instances of armstorage.LocalUsersClient to instances of LocalUsersServer. -// Don't use this type directly, use NewLocalUsersServerTransport instead. -type LocalUsersServerTransport struct { - srv *LocalUsersServer - newListPager *tracker[azfake.PagerResponder[armstorage.LocalUsersClientListResponse]] -} - -// Do implements the policy.Transporter interface for LocalUsersServerTransport. -func (l *LocalUsersServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "LocalUsersClient.CreateOrUpdate": - resp, err = l.dispatchCreateOrUpdate(req) - case "LocalUsersClient.Delete": - resp, err = l.dispatchDelete(req) - case "LocalUsersClient.Get": - resp, err = l.dispatchGet(req) - case "LocalUsersClient.NewListPager": - resp, err = l.dispatchNewListPager(req) - case "LocalUsersClient.ListKeys": - resp, err = l.dispatchListKeys(req) - case "LocalUsersClient.RegeneratePassword": - resp, err = l.dispatchRegeneratePassword(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (l *LocalUsersServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if l.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/localUsers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.LocalUser](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - usernameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("username")]) - if err != nil { - return nil, err - } - respr, errRespr := l.srv.CreateOrUpdate(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, usernameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LocalUser, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (l *LocalUsersServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if l.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/localUsers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - usernameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("username")]) - if err != nil { - return nil, err - } - respr, errRespr := l.srv.Delete(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, usernameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (l *LocalUsersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if l.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/localUsers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - usernameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("username")]) - if err != nil { - return nil, err - } - respr, errRespr := l.srv.Get(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, usernameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LocalUser, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (l *LocalUsersServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if l.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := l.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/localUsers` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - resp := l.srv.NewListPager(resourceGroupNameUnescaped, accountNameUnescaped, nil) - newListPager = &resp - l.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - l.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - l.newListPager.remove(req) - } - return resp, nil -} - -func (l *LocalUsersServerTransport) dispatchListKeys(req *http.Request) (*http.Response, error) { - if l.srv.ListKeys == nil { - return nil, &nonRetriableError{errors.New("fake for method ListKeys not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/localUsers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listKeys` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - usernameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("username")]) - if err != nil { - return nil, err - } - respr, errRespr := l.srv.ListKeys(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, usernameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LocalUserKeys, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (l *LocalUsersServerTransport) dispatchRegeneratePassword(req *http.Request) (*http.Response, error) { - if l.srv.RegeneratePassword == nil { - return nil, &nonRetriableError{errors.New("fake for method RegeneratePassword not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/localUsers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/regeneratePassword` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - usernameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("username")]) - if err != nil { - return nil, err - } - respr, errRespr := l.srv.RegeneratePassword(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, usernameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LocalUserRegeneratePasswordResult, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/managementpolicies_server.go b/sdk/resourcemanager/storage/armstorage/fake/managementpolicies_server.go deleted file mode 100644 index 07daad222659..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/managementpolicies_server.go +++ /dev/null @@ -1,194 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "regexp" -) - -// ManagementPoliciesServer is a fake server for instances of the armstorage.ManagementPoliciesClient type. -type ManagementPoliciesServer struct { - // CreateOrUpdate is the fake for method ManagementPoliciesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName armstorage.ManagementPolicyName, properties armstorage.ManagementPolicy, options *armstorage.ManagementPoliciesClientCreateOrUpdateOptions) (resp azfake.Responder[armstorage.ManagementPoliciesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ManagementPoliciesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName armstorage.ManagementPolicyName, options *armstorage.ManagementPoliciesClientDeleteOptions) (resp azfake.Responder[armstorage.ManagementPoliciesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ManagementPoliciesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName armstorage.ManagementPolicyName, options *armstorage.ManagementPoliciesClientGetOptions) (resp azfake.Responder[armstorage.ManagementPoliciesClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewManagementPoliciesServerTransport creates a new instance of ManagementPoliciesServerTransport with the provided implementation. -// The returned ManagementPoliciesServerTransport instance is connected to an instance of armstorage.ManagementPoliciesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewManagementPoliciesServerTransport(srv *ManagementPoliciesServer) *ManagementPoliciesServerTransport { - return &ManagementPoliciesServerTransport{srv: srv} -} - -// ManagementPoliciesServerTransport connects instances of armstorage.ManagementPoliciesClient to instances of ManagementPoliciesServer. -// Don't use this type directly, use NewManagementPoliciesServerTransport instead. -type ManagementPoliciesServerTransport struct { - srv *ManagementPoliciesServer -} - -// Do implements the policy.Transporter interface for ManagementPoliciesServerTransport. -func (m *ManagementPoliciesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ManagementPoliciesClient.CreateOrUpdate": - resp, err = m.dispatchCreateOrUpdate(req) - case "ManagementPoliciesClient.Delete": - resp, err = m.dispatchDelete(req) - case "ManagementPoliciesClient.Get": - resp, err = m.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (m *ManagementPoliciesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if m.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/managementPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.ManagementPolicy](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - managementPolicyNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("managementPolicyName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.CreateOrUpdate(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, armstorage.ManagementPolicyName(managementPolicyNameUnescaped), body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ManagementPolicy, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *ManagementPoliciesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if m.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/managementPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - managementPolicyNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("managementPolicyName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.Delete(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, armstorage.ManagementPolicyName(managementPolicyNameUnescaped), nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *ManagementPoliciesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if m.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/managementPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - managementPolicyNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("managementPolicyName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, armstorage.ManagementPolicyName(managementPolicyNameUnescaped), nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ManagementPolicy, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/objectreplicationpolicies_server.go b/sdk/resourcemanager/storage/armstorage/fake/objectreplicationpolicies_server.go deleted file mode 100644 index bec0a82e1e34..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/objectreplicationpolicies_server.go +++ /dev/null @@ -1,242 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "regexp" -) - -// ObjectReplicationPoliciesServer is a fake server for instances of the armstorage.ObjectReplicationPoliciesClient type. -type ObjectReplicationPoliciesServer struct { - // CreateOrUpdate is the fake for method ObjectReplicationPoliciesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, properties armstorage.ObjectReplicationPolicy, options *armstorage.ObjectReplicationPoliciesClientCreateOrUpdateOptions) (resp azfake.Responder[armstorage.ObjectReplicationPoliciesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ObjectReplicationPoliciesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, options *armstorage.ObjectReplicationPoliciesClientDeleteOptions) (resp azfake.Responder[armstorage.ObjectReplicationPoliciesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ObjectReplicationPoliciesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, options *armstorage.ObjectReplicationPoliciesClientGetOptions) (resp azfake.Responder[armstorage.ObjectReplicationPoliciesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method ObjectReplicationPoliciesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, accountName string, options *armstorage.ObjectReplicationPoliciesClientListOptions) (resp azfake.PagerResponder[armstorage.ObjectReplicationPoliciesClientListResponse]) -} - -// NewObjectReplicationPoliciesServerTransport creates a new instance of ObjectReplicationPoliciesServerTransport with the provided implementation. -// The returned ObjectReplicationPoliciesServerTransport instance is connected to an instance of armstorage.ObjectReplicationPoliciesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewObjectReplicationPoliciesServerTransport(srv *ObjectReplicationPoliciesServer) *ObjectReplicationPoliciesServerTransport { - return &ObjectReplicationPoliciesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armstorage.ObjectReplicationPoliciesClientListResponse]](), - } -} - -// ObjectReplicationPoliciesServerTransport connects instances of armstorage.ObjectReplicationPoliciesClient to instances of ObjectReplicationPoliciesServer. -// Don't use this type directly, use NewObjectReplicationPoliciesServerTransport instead. -type ObjectReplicationPoliciesServerTransport struct { - srv *ObjectReplicationPoliciesServer - newListPager *tracker[azfake.PagerResponder[armstorage.ObjectReplicationPoliciesClientListResponse]] -} - -// Do implements the policy.Transporter interface for ObjectReplicationPoliciesServerTransport. -func (o *ObjectReplicationPoliciesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ObjectReplicationPoliciesClient.CreateOrUpdate": - resp, err = o.dispatchCreateOrUpdate(req) - case "ObjectReplicationPoliciesClient.Delete": - resp, err = o.dispatchDelete(req) - case "ObjectReplicationPoliciesClient.Get": - resp, err = o.dispatchGet(req) - case "ObjectReplicationPoliciesClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (o *ObjectReplicationPoliciesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if o.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/objectReplicationPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.ObjectReplicationPolicy](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - objectReplicationPolicyIDUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("objectReplicationPolicyId")]) - if err != nil { - return nil, err - } - respr, errRespr := o.srv.CreateOrUpdate(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, objectReplicationPolicyIDUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ObjectReplicationPolicy, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (o *ObjectReplicationPoliciesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if o.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/objectReplicationPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - objectReplicationPolicyIDUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("objectReplicationPolicyId")]) - if err != nil { - return nil, err - } - respr, errRespr := o.srv.Delete(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, objectReplicationPolicyIDUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (o *ObjectReplicationPoliciesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if o.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/objectReplicationPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - objectReplicationPolicyIDUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("objectReplicationPolicyId")]) - if err != nil { - return nil, err - } - respr, errRespr := o.srv.Get(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, objectReplicationPolicyIDUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ObjectReplicationPolicy, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (o *ObjectReplicationPoliciesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if o.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := o.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/objectReplicationPolicies` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - resp := o.srv.NewListPager(resourceGroupNameUnescaped, accountNameUnescaped, nil) - newListPager = &resp - o.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - o.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - o.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/operations_server.go b/sdk/resourcemanager/storage/armstorage/fake/operations_server.go deleted file mode 100644 index 91d748837564..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/operations_server.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" -) - -// OperationsServer is a fake server for instances of the armstorage.OperationsClient type. -type OperationsServer struct { - // NewListPager is the fake for method OperationsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armstorage.OperationsClientListOptions) (resp azfake.PagerResponder[armstorage.OperationsClientListResponse]) -} - -// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. -// The returned OperationsServerTransport instance is connected to an instance of armstorage.OperationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { - return &OperationsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armstorage.OperationsClientListResponse]](), - } -} - -// OperationsServerTransport connects instances of armstorage.OperationsClient to instances of OperationsServer. -// Don't use this type directly, use NewOperationsServerTransport instead. -type OperationsServerTransport struct { - srv *OperationsServer - newListPager *tracker[azfake.PagerResponder[armstorage.OperationsClientListResponse]] -} - -// Do implements the policy.Transporter interface for OperationsServerTransport. -func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if o.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := o.newListPager.get(req) - if newListPager == nil { - resp := o.srv.NewListPager(nil) - newListPager = &resp - o.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - o.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - o.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/privateendpointconnections_server.go b/sdk/resourcemanager/storage/armstorage/fake/privateendpointconnections_server.go deleted file mode 100644 index 177ee97f8c98..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/privateendpointconnections_server.go +++ /dev/null @@ -1,242 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "regexp" -) - -// PrivateEndpointConnectionsServer is a fake server for instances of the armstorage.PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsServer struct { - // Delete is the fake for method PrivateEndpointConnectionsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *armstorage.PrivateEndpointConnectionsClientDeleteOptions) (resp azfake.Responder[armstorage.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method PrivateEndpointConnectionsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *armstorage.PrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armstorage.PrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method PrivateEndpointConnectionsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, accountName string, options *armstorage.PrivateEndpointConnectionsClientListOptions) (resp azfake.PagerResponder[armstorage.PrivateEndpointConnectionsClientListResponse]) - - // Put is the fake for method PrivateEndpointConnectionsClient.Put - // HTTP status codes to indicate success: http.StatusOK - Put func(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties armstorage.PrivateEndpointConnection, options *armstorage.PrivateEndpointConnectionsClientPutOptions) (resp azfake.Responder[armstorage.PrivateEndpointConnectionsClientPutResponse], errResp azfake.ErrorResponder) -} - -// NewPrivateEndpointConnectionsServerTransport creates a new instance of PrivateEndpointConnectionsServerTransport with the provided implementation. -// The returned PrivateEndpointConnectionsServerTransport instance is connected to an instance of armstorage.PrivateEndpointConnectionsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateEndpointConnectionsServerTransport(srv *PrivateEndpointConnectionsServer) *PrivateEndpointConnectionsServerTransport { - return &PrivateEndpointConnectionsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armstorage.PrivateEndpointConnectionsClientListResponse]](), - } -} - -// PrivateEndpointConnectionsServerTransport connects instances of armstorage.PrivateEndpointConnectionsClient to instances of PrivateEndpointConnectionsServer. -// Don't use this type directly, use NewPrivateEndpointConnectionsServerTransport instead. -type PrivateEndpointConnectionsServerTransport struct { - srv *PrivateEndpointConnectionsServer - newListPager *tracker[azfake.PagerResponder[armstorage.PrivateEndpointConnectionsClientListResponse]] -} - -// Do implements the policy.Transporter interface for PrivateEndpointConnectionsServerTransport. -func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateEndpointConnectionsClient.Delete": - resp, err = p.dispatchDelete(req) - case "PrivateEndpointConnectionsClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateEndpointConnectionsClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - case "PrivateEndpointConnectionsClient.Put": - resp, err = p.dispatchPut(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateEndpointConnectionsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if p.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Delete(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, privateEndpointConnectionNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, privateEndpointConnectionNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if p.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := p.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - resp := p.srv.NewListPager(resourceGroupNameUnescaped, accountNameUnescaped, nil) - newListPager = &resp - p.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - p.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - p.newListPager.remove(req) - } - return resp, nil -} - -func (p *PrivateEndpointConnectionsServerTransport) dispatchPut(req *http.Request) (*http.Response, error) { - if p.srv.Put == nil { - return nil, &nonRetriableError{errors.New("fake for method Put not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.PrivateEndpointConnection](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Put(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, privateEndpointConnectionNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/privatelinkresources_server.go b/sdk/resourcemanager/storage/armstorage/fake/privatelinkresources_server.go deleted file mode 100644 index e1ee18979e38..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/privatelinkresources_server.go +++ /dev/null @@ -1,100 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "regexp" -) - -// PrivateLinkResourcesServer is a fake server for instances of the armstorage.PrivateLinkResourcesClient type. -type PrivateLinkResourcesServer struct { - // ListByStorageAccount is the fake for method PrivateLinkResourcesClient.ListByStorageAccount - // HTTP status codes to indicate success: http.StatusOK - ListByStorageAccount func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.PrivateLinkResourcesClientListByStorageAccountOptions) (resp azfake.Responder[armstorage.PrivateLinkResourcesClientListByStorageAccountResponse], errResp azfake.ErrorResponder) -} - -// NewPrivateLinkResourcesServerTransport creates a new instance of PrivateLinkResourcesServerTransport with the provided implementation. -// The returned PrivateLinkResourcesServerTransport instance is connected to an instance of armstorage.PrivateLinkResourcesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateLinkResourcesServerTransport(srv *PrivateLinkResourcesServer) *PrivateLinkResourcesServerTransport { - return &PrivateLinkResourcesServerTransport{srv: srv} -} - -// PrivateLinkResourcesServerTransport connects instances of armstorage.PrivateLinkResourcesClient to instances of PrivateLinkResourcesServer. -// Don't use this type directly, use NewPrivateLinkResourcesServerTransport instead. -type PrivateLinkResourcesServerTransport struct { - srv *PrivateLinkResourcesServer -} - -// Do implements the policy.Transporter interface for PrivateLinkResourcesServerTransport. -func (p *PrivateLinkResourcesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateLinkResourcesClient.ListByStorageAccount": - resp, err = p.dispatchListByStorageAccount(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateLinkResourcesServerTransport) dispatchListByStorageAccount(req *http.Request) (*http.Response, error) { - if p.srv.ListByStorageAccount == nil { - return nil, &nonRetriableError{errors.New("fake for method ListByStorageAccount not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.ListByStorageAccount(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResourceListResult, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/queue_server.go b/sdk/resourcemanager/storage/armstorage/fake/queue_server.go deleted file mode 100644 index 270710170ed0..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/queue_server.go +++ /dev/null @@ -1,311 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "regexp" -) - -// QueueServer is a fake server for instances of the armstorage.QueueClient type. -type QueueServer struct { - // Create is the fake for method QueueClient.Create - // HTTP status codes to indicate success: http.StatusOK - Create func(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue armstorage.Queue, options *armstorage.QueueClientCreateOptions) (resp azfake.Responder[armstorage.QueueClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method QueueClient.Delete - // HTTP status codes to indicate success: http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, accountName string, queueName string, options *armstorage.QueueClientDeleteOptions) (resp azfake.Responder[armstorage.QueueClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method QueueClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, accountName string, queueName string, options *armstorage.QueueClientGetOptions) (resp azfake.Responder[armstorage.QueueClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method QueueClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, accountName string, options *armstorage.QueueClientListOptions) (resp azfake.PagerResponder[armstorage.QueueClientListResponse]) - - // Update is the fake for method QueueClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue armstorage.Queue, options *armstorage.QueueClientUpdateOptions) (resp azfake.Responder[armstorage.QueueClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewQueueServerTransport creates a new instance of QueueServerTransport with the provided implementation. -// The returned QueueServerTransport instance is connected to an instance of armstorage.QueueClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewQueueServerTransport(srv *QueueServer) *QueueServerTransport { - return &QueueServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armstorage.QueueClientListResponse]](), - } -} - -// QueueServerTransport connects instances of armstorage.QueueClient to instances of QueueServer. -// Don't use this type directly, use NewQueueServerTransport instead. -type QueueServerTransport struct { - srv *QueueServer - newListPager *tracker[azfake.PagerResponder[armstorage.QueueClientListResponse]] -} - -// Do implements the policy.Transporter interface for QueueServerTransport. -func (q *QueueServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "QueueClient.Create": - resp, err = q.dispatchCreate(req) - case "QueueClient.Delete": - resp, err = q.dispatchDelete(req) - case "QueueClient.Get": - resp, err = q.dispatchGet(req) - case "QueueClient.NewListPager": - resp, err = q.dispatchNewListPager(req) - case "QueueClient.Update": - resp, err = q.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (q *QueueServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if q.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/queueServices/default/queues/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.Queue](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - queueNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("queueName")]) - if err != nil { - return nil, err - } - respr, errRespr := q.srv.Create(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, queueNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Queue, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (q *QueueServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if q.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/queueServices/default/queues/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - queueNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("queueName")]) - if err != nil { - return nil, err - } - respr, errRespr := q.srv.Delete(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, queueNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (q *QueueServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if q.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/queueServices/default/queues/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - queueNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("queueName")]) - if err != nil { - return nil, err - } - respr, errRespr := q.srv.Get(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, queueNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Queue, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (q *QueueServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if q.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := q.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/queueServices/default/queues` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - maxpagesizeUnescaped, err := url.QueryUnescape(qp.Get("$maxpagesize")) - if err != nil { - return nil, err - } - maxpagesizeParam := getOptional(maxpagesizeUnescaped) - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - var options *armstorage.QueueClientListOptions - if maxpagesizeParam != nil || filterParam != nil { - options = &armstorage.QueueClientListOptions{ - Maxpagesize: maxpagesizeParam, - Filter: filterParam, - } - } - resp := q.srv.NewListPager(resourceGroupNameUnescaped, accountNameUnescaped, options) - newListPager = &resp - q.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armstorage.QueueClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - q.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - q.newListPager.remove(req) - } - return resp, nil -} - -func (q *QueueServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if q.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/queueServices/default/queues/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.Queue](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - queueNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("queueName")]) - if err != nil { - return nil, err - } - respr, errRespr := q.srv.Update(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, queueNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Queue, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/queueservices_server.go b/sdk/resourcemanager/storage/armstorage/fake/queueservices_server.go deleted file mode 100644 index 186c25f50811..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/queueservices_server.go +++ /dev/null @@ -1,182 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "regexp" -) - -// QueueServicesServer is a fake server for instances of the armstorage.QueueServicesClient type. -type QueueServicesServer struct { - // GetServiceProperties is the fake for method QueueServicesClient.GetServiceProperties - // HTTP status codes to indicate success: http.StatusOK - GetServiceProperties func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.QueueServicesClientGetServicePropertiesOptions) (resp azfake.Responder[armstorage.QueueServicesClientGetServicePropertiesResponse], errResp azfake.ErrorResponder) - - // List is the fake for method QueueServicesClient.List - // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.QueueServicesClientListOptions) (resp azfake.Responder[armstorage.QueueServicesClientListResponse], errResp azfake.ErrorResponder) - - // SetServiceProperties is the fake for method QueueServicesClient.SetServiceProperties - // HTTP status codes to indicate success: http.StatusOK - SetServiceProperties func(ctx context.Context, resourceGroupName string, accountName string, parameters armstorage.QueueServiceProperties, options *armstorage.QueueServicesClientSetServicePropertiesOptions) (resp azfake.Responder[armstorage.QueueServicesClientSetServicePropertiesResponse], errResp azfake.ErrorResponder) -} - -// NewQueueServicesServerTransport creates a new instance of QueueServicesServerTransport with the provided implementation. -// The returned QueueServicesServerTransport instance is connected to an instance of armstorage.QueueServicesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewQueueServicesServerTransport(srv *QueueServicesServer) *QueueServicesServerTransport { - return &QueueServicesServerTransport{srv: srv} -} - -// QueueServicesServerTransport connects instances of armstorage.QueueServicesClient to instances of QueueServicesServer. -// Don't use this type directly, use NewQueueServicesServerTransport instead. -type QueueServicesServerTransport struct { - srv *QueueServicesServer -} - -// Do implements the policy.Transporter interface for QueueServicesServerTransport. -func (q *QueueServicesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "QueueServicesClient.GetServiceProperties": - resp, err = q.dispatchGetServiceProperties(req) - case "QueueServicesClient.List": - resp, err = q.dispatchList(req) - case "QueueServicesClient.SetServiceProperties": - resp, err = q.dispatchSetServiceProperties(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (q *QueueServicesServerTransport) dispatchGetServiceProperties(req *http.Request) (*http.Response, error) { - if q.srv.GetServiceProperties == nil { - return nil, &nonRetriableError{errors.New("fake for method GetServiceProperties not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/queueServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := q.srv.GetServiceProperties(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).QueueServiceProperties, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (q *QueueServicesServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if q.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/queueServices` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := q.srv.List(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ListQueueServices, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (q *QueueServicesServerTransport) dispatchSetServiceProperties(req *http.Request) (*http.Response, error) { - if q.srv.SetServiceProperties == nil { - return nil, &nonRetriableError{errors.New("fake for method SetServiceProperties not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/queueServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.QueueServiceProperties](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := q.srv.SetServiceProperties(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).QueueServiceProperties, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/skus_server.go b/sdk/resourcemanager/storage/armstorage/fake/skus_server.go deleted file mode 100644 index 06f08652254d..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/skus_server.go +++ /dev/null @@ -1,99 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "regexp" -) - -// SKUsServer is a fake server for instances of the armstorage.SKUsClient type. -type SKUsServer struct { - // NewListPager is the fake for method SKUsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armstorage.SKUsClientListOptions) (resp azfake.PagerResponder[armstorage.SKUsClientListResponse]) -} - -// NewSKUsServerTransport creates a new instance of SKUsServerTransport with the provided implementation. -// The returned SKUsServerTransport instance is connected to an instance of armstorage.SKUsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewSKUsServerTransport(srv *SKUsServer) *SKUsServerTransport { - return &SKUsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armstorage.SKUsClientListResponse]](), - } -} - -// SKUsServerTransport connects instances of armstorage.SKUsClient to instances of SKUsServer. -// Don't use this type directly, use NewSKUsServerTransport instead. -type SKUsServerTransport struct { - srv *SKUsServer - newListPager *tracker[azfake.PagerResponder[armstorage.SKUsClientListResponse]] -} - -// Do implements the policy.Transporter interface for SKUsServerTransport. -func (s *SKUsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "SKUsClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *SKUsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if s.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := s.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/skus` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := s.srv.NewListPager(nil) - newListPager = &resp - s.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - s.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/table_server.go b/sdk/resourcemanager/storage/armstorage/fake/table_server.go deleted file mode 100644 index 639155ccd0d1..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/table_server.go +++ /dev/null @@ -1,306 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// TableServer is a fake server for instances of the armstorage.TableClient type. -type TableServer struct { - // Create is the fake for method TableClient.Create - // HTTP status codes to indicate success: http.StatusOK - Create func(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *armstorage.TableClientCreateOptions) (resp azfake.Responder[armstorage.TableClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method TableClient.Delete - // HTTP status codes to indicate success: http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *armstorage.TableClientDeleteOptions) (resp azfake.Responder[armstorage.TableClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method TableClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *armstorage.TableClientGetOptions) (resp azfake.Responder[armstorage.TableClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method TableClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, accountName string, options *armstorage.TableClientListOptions) (resp azfake.PagerResponder[armstorage.TableClientListResponse]) - - // Update is the fake for method TableClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *armstorage.TableClientUpdateOptions) (resp azfake.Responder[armstorage.TableClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewTableServerTransport creates a new instance of TableServerTransport with the provided implementation. -// The returned TableServerTransport instance is connected to an instance of armstorage.TableClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewTableServerTransport(srv *TableServer) *TableServerTransport { - return &TableServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armstorage.TableClientListResponse]](), - } -} - -// TableServerTransport connects instances of armstorage.TableClient to instances of TableServer. -// Don't use this type directly, use NewTableServerTransport instead. -type TableServerTransport struct { - srv *TableServer - newListPager *tracker[azfake.PagerResponder[armstorage.TableClientListResponse]] -} - -// Do implements the policy.Transporter interface for TableServerTransport. -func (t *TableServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "TableClient.Create": - resp, err = t.dispatchCreate(req) - case "TableClient.Delete": - resp, err = t.dispatchDelete(req) - case "TableClient.Get": - resp, err = t.dispatchGet(req) - case "TableClient.NewListPager": - resp, err = t.dispatchNewListPager(req) - case "TableClient.Update": - resp, err = t.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (t *TableServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if t.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tableServices/default/tables/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.Table](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - tableNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("tableName")]) - if err != nil { - return nil, err - } - var options *armstorage.TableClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armstorage.TableClientCreateOptions{ - Parameters: &body, - } - } - respr, errRespr := t.srv.Create(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, tableNameUnescaped, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Table, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TableServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if t.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tableServices/default/tables/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - tableNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("tableName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.Delete(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, tableNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TableServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if t.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tableServices/default/tables/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - tableNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("tableName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, tableNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Table, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TableServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if t.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := t.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tableServices/default/tables` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - resp := t.srv.NewListPager(resourceGroupNameUnescaped, accountNameUnescaped, nil) - newListPager = &resp - t.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armstorage.TableClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - t.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - t.newListPager.remove(req) - } - return resp, nil -} - -func (t *TableServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if t.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tableServices/default/tables/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.Table](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - tableNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("tableName")]) - if err != nil { - return nil, err - } - var options *armstorage.TableClientUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armstorage.TableClientUpdateOptions{ - Parameters: &body, - } - } - respr, errRespr := t.srv.Update(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, tableNameUnescaped, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Table, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/tableservices_server.go b/sdk/resourcemanager/storage/armstorage/fake/tableservices_server.go deleted file mode 100644 index 8edb35f172fb..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/tableservices_server.go +++ /dev/null @@ -1,182 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "regexp" -) - -// TableServicesServer is a fake server for instances of the armstorage.TableServicesClient type. -type TableServicesServer struct { - // GetServiceProperties is the fake for method TableServicesClient.GetServiceProperties - // HTTP status codes to indicate success: http.StatusOK - GetServiceProperties func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.TableServicesClientGetServicePropertiesOptions) (resp azfake.Responder[armstorage.TableServicesClientGetServicePropertiesResponse], errResp azfake.ErrorResponder) - - // List is the fake for method TableServicesClient.List - // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.TableServicesClientListOptions) (resp azfake.Responder[armstorage.TableServicesClientListResponse], errResp azfake.ErrorResponder) - - // SetServiceProperties is the fake for method TableServicesClient.SetServiceProperties - // HTTP status codes to indicate success: http.StatusOK - SetServiceProperties func(ctx context.Context, resourceGroupName string, accountName string, parameters armstorage.TableServiceProperties, options *armstorage.TableServicesClientSetServicePropertiesOptions) (resp azfake.Responder[armstorage.TableServicesClientSetServicePropertiesResponse], errResp azfake.ErrorResponder) -} - -// NewTableServicesServerTransport creates a new instance of TableServicesServerTransport with the provided implementation. -// The returned TableServicesServerTransport instance is connected to an instance of armstorage.TableServicesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewTableServicesServerTransport(srv *TableServicesServer) *TableServicesServerTransport { - return &TableServicesServerTransport{srv: srv} -} - -// TableServicesServerTransport connects instances of armstorage.TableServicesClient to instances of TableServicesServer. -// Don't use this type directly, use NewTableServicesServerTransport instead. -type TableServicesServerTransport struct { - srv *TableServicesServer -} - -// Do implements the policy.Transporter interface for TableServicesServerTransport. -func (t *TableServicesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "TableServicesClient.GetServiceProperties": - resp, err = t.dispatchGetServiceProperties(req) - case "TableServicesClient.List": - resp, err = t.dispatchList(req) - case "TableServicesClient.SetServiceProperties": - resp, err = t.dispatchSetServiceProperties(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (t *TableServicesServerTransport) dispatchGetServiceProperties(req *http.Request) (*http.Response, error) { - if t.srv.GetServiceProperties == nil { - return nil, &nonRetriableError{errors.New("fake for method GetServiceProperties not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tableServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.GetServiceProperties(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TableServiceProperties, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TableServicesServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if t.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tableServices` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.List(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ListTableServices, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TableServicesServerTransport) dispatchSetServiceProperties(req *http.Request) (*http.Response, error) { - if t.srv.SetServiceProperties == nil { - return nil, &nonRetriableError{errors.New("fake for method SetServiceProperties not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/storageAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tableServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armstorage.TableServiceProperties](req) - if err != nil { - return nil, err - } - resourceGroupNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - accountNameUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.SetServiceProperties(req.Context(), resourceGroupNameUnescaped, accountNameUnescaped, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TableServiceProperties, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/time_rfc3339.go b/sdk/resourcemanager/storage/armstorage/fake/time_rfc3339.go deleted file mode 100644 index 45fe10cbc6df..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/time_rfc3339.go +++ /dev/null @@ -1,86 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -const ( - utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` - utcLayout = "2006-01-02T15:04:05.999999999" - rfc3339JSON = `"` + time.RFC3339Nano + `"` -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) - -type timeRFC3339 time.Time - -func (t timeRFC3339) MarshalJSON() (json []byte, err error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t timeRFC3339) MarshalText() (text []byte, err error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcLayoutJSON - if tzOffsetRegex.Match(data) { - layout = rfc3339JSON - } - return t.Parse(layout, string(data)) -} - -func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { - layout := utcLayout - if tzOffsetRegex.Match(data) { - layout = time.RFC3339Nano - } - return t.Parse(layout, string(data)) -} - -func (t *timeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) - return err -} - -func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*timeRFC3339)(t) -} - -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { - return nil - } - var aux timeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake/usages_server.go b/sdk/resourcemanager/storage/armstorage/fake/usages_server.go deleted file mode 100644 index c0f3e760941d..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake/usages_server.go +++ /dev/null @@ -1,104 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "net/http" - "net/url" - "regexp" -) - -// UsagesServer is a fake server for instances of the armstorage.UsagesClient type. -type UsagesServer struct { - // NewListByLocationPager is the fake for method UsagesClient.NewListByLocationPager - // HTTP status codes to indicate success: http.StatusOK - NewListByLocationPager func(location string, options *armstorage.UsagesClientListByLocationOptions) (resp azfake.PagerResponder[armstorage.UsagesClientListByLocationResponse]) -} - -// NewUsagesServerTransport creates a new instance of UsagesServerTransport with the provided implementation. -// The returned UsagesServerTransport instance is connected to an instance of armstorage.UsagesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewUsagesServerTransport(srv *UsagesServer) *UsagesServerTransport { - return &UsagesServerTransport{ - srv: srv, - newListByLocationPager: newTracker[azfake.PagerResponder[armstorage.UsagesClientListByLocationResponse]](), - } -} - -// UsagesServerTransport connects instances of armstorage.UsagesClient to instances of UsagesServer. -// Don't use this type directly, use NewUsagesServerTransport instead. -type UsagesServerTransport struct { - srv *UsagesServer - newListByLocationPager *tracker[azfake.PagerResponder[armstorage.UsagesClientListByLocationResponse]] -} - -// Do implements the policy.Transporter interface for UsagesServerTransport. -func (u *UsagesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "UsagesClient.NewListByLocationPager": - resp, err = u.dispatchNewListByLocationPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (u *UsagesServerTransport) dispatchNewListByLocationPager(req *http.Request) (*http.Response, error) { - if u.srv.NewListByLocationPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByLocationPager not implemented")} - } - newListByLocationPager := u.newListByLocationPager.get(req) - if newListByLocationPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft.Storage/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/usages` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - locationUnescaped, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - resp := u.srv.NewListByLocationPager(locationUnescaped, nil) - newListByLocationPager = &resp - u.newListByLocationPager.add(req, newListByLocationPager) - } - resp, err := server.PagerResponderNext(newListByLocationPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - u.newListByLocationPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByLocationPager) { - u.newListByLocationPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/storage/armstorage/fake_example_test.go b/sdk/resourcemanager/storage/armstorage/fake_example_test.go deleted file mode 100644 index 055958399b09..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fake_example_test.go +++ /dev/null @@ -1,79 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -package armstorage_test - -import ( - "context" - "fmt" - "log" - "net/http" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/fake" -) - -func ExampleAccountsServer() { - // first, create an instance of the fake server for the client you wish to test. - // the type name of the server will be similar to the corresponding client, with - // the suffix "Server" instead of "Client". - fakeAccountsServer := fake.AccountsServer{ - - // next, provide implementations for the APIs you wish to fake. - // this fake corresponds to the AccountsClient.GetProperties() API. - GetProperties: func(ctx context.Context, resourceGroupName string, accountName string, options *armstorage.AccountsClientGetPropertiesOptions) (resp azfake.Responder[armstorage.AccountsClientGetPropertiesResponse], errResp azfake.ErrorResponder) { - // the values of ctx, resourceGroupName, accountName, and options come from the API call. - - // the named return values resp and errResp are used to construct the response - // and are meant to be mutually exclusive. if both responses have been constructed, - // the error response is selected. - - // construct the response type, populating fields as required - accountResp := armstorage.AccountsClientGetPropertiesResponse{} - accountResp.ID = to.Ptr("/fake/resource/id") - - // use resp to set the desired response - resp.SetResponse(http.StatusOK, accountResp, nil) - - // to simulate the failure case, use errResp - //errResp.SetResponseError(http.StatusBadRequest, "ThisIsASimulatedError") - - return - }, - } - - // now create the corresponding client, connecting the fake server via the client options - client, err := armstorage.NewAccountsClient("subscriptionID", azfake.NewTokenCredential(), &arm.ClientOptions{ - ClientOptions: azcore.ClientOptions{ - Transport: fake.NewAccountsServerTransport(&fakeAccountsServer), - }, - }) - if err != nil { - log.Fatal(err) - } - - // call the API. the provided values will be passed to the fake's implementation. - // the response or error values returned by the API call are from the fake. - resp, err := client.GetProperties(context.TODO(), "fakeResourceGroup", "fakeVM", nil) - if err != nil { - log.Fatal(err) - } - - fmt.Println(*resp.ID) - - // APIs that haven't been faked will return an error - _, err = client.CheckNameAvailability(context.TODO(), armstorage.AccountCheckNameAvailabilityParameters{}, nil) - - fmt.Println(err.Error()) - - // Output: - // /fake/resource/id - // fake for method CheckNameAvailability not implemented -} diff --git a/sdk/resourcemanager/storage/armstorage/fileservices_client.go b/sdk/resourcemanager/storage/armstorage/fileservices_client.go index 1dcc7cf320b1..00da3cdbdfca 100644 --- a/sdk/resourcemanager/storage/armstorage/fileservices_client.go +++ b/sdk/resourcemanager/storage/armstorage/fileservices_client.go @@ -55,10 +55,6 @@ func NewFileServicesClient(subscriptionID string, credential azcore.TokenCredent // method. func (client *FileServicesClient) GetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, options *FileServicesClientGetServicePropertiesOptions) (FileServicesClientGetServicePropertiesResponse, error) { var err error - const operationName = "FileServicesClient.GetServiceProperties" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return FileServicesClientGetServicePropertiesResponse{}, err @@ -121,10 +117,6 @@ func (client *FileServicesClient) getServicePropertiesHandleResponse(resp *http. // - options - FileServicesClientListOptions contains the optional parameters for the FileServicesClient.List method. func (client *FileServicesClient) List(ctx context.Context, resourceGroupName string, accountName string, options *FileServicesClientListOptions) (FileServicesClientListResponse, error) { var err error - const operationName = "FileServicesClient.List" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return FileServicesClientListResponse{}, err @@ -189,10 +181,6 @@ func (client *FileServicesClient) listHandleResponse(resp *http.Response) (FileS // method. func (client *FileServicesClient) SetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, parameters FileServiceProperties, options *FileServicesClientSetServicePropertiesOptions) (FileServicesClientSetServicePropertiesResponse, error) { var err error - const operationName = "FileServicesClient.SetServiceProperties" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.setServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, parameters, options) if err != nil { return FileServicesClientSetServicePropertiesResponse{}, err diff --git a/sdk/resourcemanager/storage/armstorage/fileshares_client.go b/sdk/resourcemanager/storage/armstorage/fileshares_client.go index b44e5c2bc024..80e40e5b26b0 100644 --- a/sdk/resourcemanager/storage/armstorage/fileshares_client.go +++ b/sdk/resourcemanager/storage/armstorage/fileshares_client.go @@ -59,10 +59,6 @@ func NewFileSharesClient(subscriptionID string, credential azcore.TokenCredentia // - options - FileSharesClientCreateOptions contains the optional parameters for the FileSharesClient.Create method. func (client *FileSharesClient) Create(ctx context.Context, resourceGroupName string, accountName string, shareName string, fileShare FileShare, options *FileSharesClientCreateOptions) (FileSharesClientCreateResponse, error) { var err error - const operationName = "FileSharesClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, shareName, fileShare, options) if err != nil { return FileSharesClientCreateResponse{}, err @@ -137,10 +133,6 @@ func (client *FileSharesClient) createHandleResponse(resp *http.Response) (FileS // - options - FileSharesClientDeleteOptions contains the optional parameters for the FileSharesClient.Delete method. func (client *FileSharesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *FileSharesClientDeleteOptions) (FileSharesClientDeleteResponse, error) { var err error - const operationName = "FileSharesClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, shareName, options) if err != nil { return FileSharesClientDeleteResponse{}, err @@ -205,10 +197,6 @@ func (client *FileSharesClient) deleteCreateRequest(ctx context.Context, resourc // - options - FileSharesClientGetOptions contains the optional parameters for the FileSharesClient.Get method. func (client *FileSharesClient) Get(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *FileSharesClientGetOptions) (FileSharesClientGetResponse, error) { var err error - const operationName = "FileSharesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, shareName, options) if err != nil { return FileSharesClientGetResponse{}, err @@ -284,10 +272,6 @@ func (client *FileSharesClient) getHandleResponse(resp *http.Response) (FileShar // - options - FileSharesClientLeaseOptions contains the optional parameters for the FileSharesClient.Lease method. func (client *FileSharesClient) Lease(ctx context.Context, resourceGroupName string, accountName string, shareName string, options *FileSharesClientLeaseOptions) (FileSharesClientLeaseResponse, error) { var err error - const operationName = "FileSharesClient.Lease" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.leaseCreateRequest(ctx, resourceGroupName, accountName, shareName, options) if err != nil { return FileSharesClientLeaseResponse{}, err @@ -368,7 +352,6 @@ func (client *FileSharesClient) NewListPager(resourceGroupName string, accountNa return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *FileSharesClientListResponse) (FileSharesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FileSharesClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -388,7 +371,6 @@ func (client *FileSharesClient) NewListPager(resourceGroupName string, accountNa } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -449,10 +431,6 @@ func (client *FileSharesClient) listHandleResponse(resp *http.Response) (FileSha // - options - FileSharesClientRestoreOptions contains the optional parameters for the FileSharesClient.Restore method. func (client *FileSharesClient) Restore(ctx context.Context, resourceGroupName string, accountName string, shareName string, deletedShare DeletedShare, options *FileSharesClientRestoreOptions) (FileSharesClientRestoreResponse, error) { var err error - const operationName = "FileSharesClient.Restore" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.restoreCreateRequest(ctx, resourceGroupName, accountName, shareName, deletedShare, options) if err != nil { return FileSharesClientRestoreResponse{}, err @@ -516,10 +494,6 @@ func (client *FileSharesClient) restoreCreateRequest(ctx context.Context, resour // - options - FileSharesClientUpdateOptions contains the optional parameters for the FileSharesClient.Update method. func (client *FileSharesClient) Update(ctx context.Context, resourceGroupName string, accountName string, shareName string, fileShare FileShare, options *FileSharesClientUpdateOptions) (FileSharesClientUpdateResponse, error) { var err error - const operationName = "FileSharesClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, shareName, fileShare, options) if err != nil { return FileSharesClientUpdateResponse{}, err diff --git a/sdk/resourcemanager/storage/armstorage/localusers_client.go b/sdk/resourcemanager/storage/armstorage/localusers_client.go index b383525adffc..6f4f9ccc1e28 100644 --- a/sdk/resourcemanager/storage/armstorage/localusers_client.go +++ b/sdk/resourcemanager/storage/armstorage/localusers_client.go @@ -57,10 +57,6 @@ func NewLocalUsersClient(subscriptionID string, credential azcore.TokenCredentia // method. func (client *LocalUsersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, username string, properties LocalUser, options *LocalUsersClientCreateOrUpdateOptions) (LocalUsersClientCreateOrUpdateResponse, error) { var err error - const operationName = "LocalUsersClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, username, properties, options) if err != nil { return LocalUsersClientCreateOrUpdateResponse{}, err @@ -131,10 +127,6 @@ func (client *LocalUsersClient) createOrUpdateHandleResponse(resp *http.Response // - options - LocalUsersClientDeleteOptions contains the optional parameters for the LocalUsersClient.Delete method. func (client *LocalUsersClient) Delete(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientDeleteOptions) (LocalUsersClientDeleteResponse, error) { var err error - const operationName = "LocalUsersClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, username, options) if err != nil { return LocalUsersClientDeleteResponse{}, err @@ -192,10 +184,6 @@ func (client *LocalUsersClient) deleteCreateRequest(ctx context.Context, resourc // - options - LocalUsersClientGetOptions contains the optional parameters for the LocalUsersClient.Get method. func (client *LocalUsersClient) Get(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientGetOptions) (LocalUsersClientGetResponse, error) { var err error - const operationName = "LocalUsersClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, username, options) if err != nil { return LocalUsersClientGetResponse{}, err @@ -264,7 +252,6 @@ func (client *LocalUsersClient) NewListPager(resourceGroupName string, accountNa return false }, Fetcher: func(ctx context.Context, page *LocalUsersClientListResponse) (LocalUsersClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "LocalUsersClient.NewListPager") req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return LocalUsersClientListResponse{}, err @@ -278,7 +265,6 @@ func (client *LocalUsersClient) NewListPager(resourceGroupName string, accountNa } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -329,10 +315,6 @@ func (client *LocalUsersClient) listHandleResponse(resp *http.Response) (LocalUs // - options - LocalUsersClientListKeysOptions contains the optional parameters for the LocalUsersClient.ListKeys method. func (client *LocalUsersClient) ListKeys(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientListKeysOptions) (LocalUsersClientListKeysResponse, error) { var err error - const operationName = "LocalUsersClient.ListKeys" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.listKeysCreateRequest(ctx, resourceGroupName, accountName, username, options) if err != nil { return LocalUsersClientListKeysResponse{}, err @@ -401,10 +383,6 @@ func (client *LocalUsersClient) listKeysHandleResponse(resp *http.Response) (Loc // method. func (client *LocalUsersClient) RegeneratePassword(ctx context.Context, resourceGroupName string, accountName string, username string, options *LocalUsersClientRegeneratePasswordOptions) (LocalUsersClientRegeneratePasswordResponse, error) { var err error - const operationName = "LocalUsersClient.RegeneratePassword" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.regeneratePasswordCreateRequest(ctx, resourceGroupName, accountName, username, options) if err != nil { return LocalUsersClientRegeneratePasswordResponse{}, err diff --git a/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go b/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go index 2c743f68d9fa..a0bbce4af786 100644 --- a/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go +++ b/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go @@ -56,10 +56,6 @@ func NewManagementPoliciesClient(subscriptionID string, credential azcore.TokenC // method. func (client *ManagementPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName ManagementPolicyName, properties ManagementPolicy, options *ManagementPoliciesClientCreateOrUpdateOptions) (ManagementPoliciesClientCreateOrUpdateResponse, error) { var err error - const operationName = "ManagementPoliciesClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, managementPolicyName, properties, options) if err != nil { return ManagementPoliciesClientCreateOrUpdateResponse{}, err @@ -130,10 +126,6 @@ func (client *ManagementPoliciesClient) createOrUpdateHandleResponse(resp *http. // method. func (client *ManagementPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName ManagementPolicyName, options *ManagementPoliciesClientDeleteOptions) (ManagementPoliciesClientDeleteResponse, error) { var err error - const operationName = "ManagementPoliciesClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, managementPolicyName, options) if err != nil { return ManagementPoliciesClientDeleteResponse{}, err @@ -189,10 +181,6 @@ func (client *ManagementPoliciesClient) deleteCreateRequest(ctx context.Context, // - options - ManagementPoliciesClientGetOptions contains the optional parameters for the ManagementPoliciesClient.Get method. func (client *ManagementPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, managementPolicyName ManagementPolicyName, options *ManagementPoliciesClientGetOptions) (ManagementPoliciesClientGetResponse, error) { var err error - const operationName = "ManagementPoliciesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, managementPolicyName, options) if err != nil { return ManagementPoliciesClientGetResponse{}, err diff --git a/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client.go b/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client.go index 1536ffe0d689..2279128fd875 100644 --- a/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client.go +++ b/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client.go @@ -58,10 +58,6 @@ func NewObjectReplicationPoliciesClient(subscriptionID string, credential azcore // method. func (client *ObjectReplicationPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, properties ObjectReplicationPolicy, options *ObjectReplicationPoliciesClientCreateOrUpdateOptions) (ObjectReplicationPoliciesClientCreateOrUpdateResponse, error) { var err error - const operationName = "ObjectReplicationPoliciesClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, objectReplicationPolicyID, properties, options) if err != nil { return ObjectReplicationPoliciesClientCreateOrUpdateResponse{}, err @@ -134,10 +130,6 @@ func (client *ObjectReplicationPoliciesClient) createOrUpdateHandleResponse(resp // method. func (client *ObjectReplicationPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, options *ObjectReplicationPoliciesClientDeleteOptions) (ObjectReplicationPoliciesClientDeleteResponse, error) { var err error - const operationName = "ObjectReplicationPoliciesClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, objectReplicationPolicyID, options) if err != nil { return ObjectReplicationPoliciesClientDeleteResponse{}, err @@ -197,10 +189,6 @@ func (client *ObjectReplicationPoliciesClient) deleteCreateRequest(ctx context.C // method. func (client *ObjectReplicationPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, objectReplicationPolicyID string, options *ObjectReplicationPoliciesClientGetOptions) (ObjectReplicationPoliciesClientGetResponse, error) { var err error - const operationName = "ObjectReplicationPoliciesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, objectReplicationPolicyID, options) if err != nil { return ObjectReplicationPoliciesClientGetResponse{}, err @@ -270,7 +258,6 @@ func (client *ObjectReplicationPoliciesClient) NewListPager(resourceGroupName st return false }, Fetcher: func(ctx context.Context, page *ObjectReplicationPoliciesClientListResponse) (ObjectReplicationPoliciesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ObjectReplicationPoliciesClient.NewListPager") req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return ObjectReplicationPoliciesClientListResponse{}, err @@ -284,7 +271,6 @@ func (client *ObjectReplicationPoliciesClient) NewListPager(resourceGroupName st } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } diff --git a/sdk/resourcemanager/storage/armstorage/operations_client.go b/sdk/resourcemanager/storage/armstorage/operations_client.go index 4fb315aa7b09..78c839c67954 100644 --- a/sdk/resourcemanager/storage/armstorage/operations_client.go +++ b/sdk/resourcemanager/storage/armstorage/operations_client.go @@ -47,7 +47,6 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption return false }, Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") req, err := client.listCreateRequest(ctx, options) if err != nil { return OperationsClientListResponse{}, err @@ -61,7 +60,6 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } diff --git a/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go b/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go index 6e36d82ded1b..bdcfbdef4211 100644 --- a/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go +++ b/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go @@ -55,10 +55,6 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // method. func (client *PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientDeleteOptions) (PrivateEndpointConnectionsClientDeleteResponse, error) { var err error - const operationName = "PrivateEndpointConnectionsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientDeleteResponse{}, err @@ -116,10 +112,6 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { var err error - const operationName = "PrivateEndpointConnectionsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err @@ -189,7 +181,6 @@ func (client *PrivateEndpointConnectionsClient) NewListPager(resourceGroupName s return false }, Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListResponse) (PrivateEndpointConnectionsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.NewListPager") req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return PrivateEndpointConnectionsClientListResponse{}, err @@ -203,7 +194,6 @@ func (client *PrivateEndpointConnectionsClient) NewListPager(resourceGroupName s } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -255,10 +245,6 @@ func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Re // method. func (client *PrivateEndpointConnectionsClient) Put(ctx context.Context, resourceGroupName string, accountName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsClientPutOptions) (PrivateEndpointConnectionsClientPutResponse, error) { var err error - const operationName = "PrivateEndpointConnectionsClient.Put" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.putCreateRequest(ctx, resourceGroupName, accountName, privateEndpointConnectionName, properties, options) if err != nil { return PrivateEndpointConnectionsClientPutResponse{}, err diff --git a/sdk/resourcemanager/storage/armstorage/privatelinkresources_client.go b/sdk/resourcemanager/storage/armstorage/privatelinkresources_client.go index d2520e59f7de..aab6ec508f15 100644 --- a/sdk/resourcemanager/storage/armstorage/privatelinkresources_client.go +++ b/sdk/resourcemanager/storage/armstorage/privatelinkresources_client.go @@ -54,10 +54,6 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // method. func (client *PrivateLinkResourcesClient) ListByStorageAccount(ctx context.Context, resourceGroupName string, accountName string, options *PrivateLinkResourcesClientListByStorageAccountOptions) (PrivateLinkResourcesClientListByStorageAccountResponse, error) { var err error - const operationName = "PrivateLinkResourcesClient.ListByStorageAccount" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.listByStorageAccountCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return PrivateLinkResourcesClientListByStorageAccountResponse{}, err diff --git a/sdk/resourcemanager/storage/armstorage/queue_client.go b/sdk/resourcemanager/storage/armstorage/queue_client.go index fb7f6a008771..fc6e65623d11 100644 --- a/sdk/resourcemanager/storage/armstorage/queue_client.go +++ b/sdk/resourcemanager/storage/armstorage/queue_client.go @@ -57,10 +57,6 @@ func NewQueueClient(subscriptionID string, credential azcore.TokenCredential, op // - options - QueueClientCreateOptions contains the optional parameters for the QueueClient.Create method. func (client *QueueClient) Create(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue, options *QueueClientCreateOptions) (QueueClientCreateResponse, error) { var err error - const operationName = "QueueClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, queueName, queue, options) if err != nil { return QueueClientCreateResponse{}, err @@ -132,10 +128,6 @@ func (client *QueueClient) createHandleResponse(resp *http.Response) (QueueClien // - options - QueueClientDeleteOptions contains the optional parameters for the QueueClient.Delete method. func (client *QueueClient) Delete(ctx context.Context, resourceGroupName string, accountName string, queueName string, options *QueueClientDeleteOptions) (QueueClientDeleteResponse, error) { var err error - const operationName = "QueueClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, queueName, options) if err != nil { return QueueClientDeleteResponse{}, err @@ -194,10 +186,6 @@ func (client *QueueClient) deleteCreateRequest(ctx context.Context, resourceGrou // - options - QueueClientGetOptions contains the optional parameters for the QueueClient.Get method. func (client *QueueClient) Get(ctx context.Context, resourceGroupName string, accountName string, queueName string, options *QueueClientGetOptions) (QueueClientGetResponse, error) { var err error - const operationName = "QueueClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, queueName, options) if err != nil { return QueueClientGetResponse{}, err @@ -266,7 +254,6 @@ func (client *QueueClient) NewListPager(resourceGroupName string, accountName st return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *QueueClientListResponse) (QueueClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "QueueClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -286,7 +273,6 @@ func (client *QueueClient) NewListPager(resourceGroupName string, accountName st } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -345,10 +331,6 @@ func (client *QueueClient) listHandleResponse(resp *http.Response) (QueueClientL // - options - QueueClientUpdateOptions contains the optional parameters for the QueueClient.Update method. func (client *QueueClient) Update(ctx context.Context, resourceGroupName string, accountName string, queueName string, queue Queue, options *QueueClientUpdateOptions) (QueueClientUpdateResponse, error) { var err error - const operationName = "QueueClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, queueName, queue, options) if err != nil { return QueueClientUpdateResponse{}, err diff --git a/sdk/resourcemanager/storage/armstorage/queueservices_client.go b/sdk/resourcemanager/storage/armstorage/queueservices_client.go index e2946bce9d60..a51abc5afca1 100644 --- a/sdk/resourcemanager/storage/armstorage/queueservices_client.go +++ b/sdk/resourcemanager/storage/armstorage/queueservices_client.go @@ -55,10 +55,6 @@ func NewQueueServicesClient(subscriptionID string, credential azcore.TokenCreden // method. func (client *QueueServicesClient) GetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, options *QueueServicesClientGetServicePropertiesOptions) (QueueServicesClientGetServicePropertiesResponse, error) { var err error - const operationName = "QueueServicesClient.GetServiceProperties" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return QueueServicesClientGetServicePropertiesResponse{}, err @@ -121,10 +117,6 @@ func (client *QueueServicesClient) getServicePropertiesHandleResponse(resp *http // - options - QueueServicesClientListOptions contains the optional parameters for the QueueServicesClient.List method. func (client *QueueServicesClient) List(ctx context.Context, resourceGroupName string, accountName string, options *QueueServicesClientListOptions) (QueueServicesClientListResponse, error) { var err error - const operationName = "QueueServicesClient.List" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return QueueServicesClientListResponse{}, err @@ -190,10 +182,6 @@ func (client *QueueServicesClient) listHandleResponse(resp *http.Response) (Queu // method. func (client *QueueServicesClient) SetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, parameters QueueServiceProperties, options *QueueServicesClientSetServicePropertiesOptions) (QueueServicesClientSetServicePropertiesResponse, error) { var err error - const operationName = "QueueServicesClient.SetServiceProperties" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.setServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, parameters, options) if err != nil { return QueueServicesClientSetServicePropertiesResponse{}, err diff --git a/sdk/resourcemanager/storage/armstorage/skus_client.go b/sdk/resourcemanager/storage/armstorage/skus_client.go index f0549b1b5baa..2a232c58afc0 100644 --- a/sdk/resourcemanager/storage/armstorage/skus_client.go +++ b/sdk/resourcemanager/storage/armstorage/skus_client.go @@ -53,7 +53,6 @@ func (client *SKUsClient) NewListPager(options *SKUsClientListOptions) *runtime. return false }, Fetcher: func(ctx context.Context, page *SKUsClientListResponse) (SKUsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SKUsClient.NewListPager") req, err := client.listCreateRequest(ctx, options) if err != nil { return SKUsClientListResponse{}, err @@ -67,7 +66,6 @@ func (client *SKUsClient) NewListPager(options *SKUsClientListOptions) *runtime. } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } diff --git a/sdk/resourcemanager/storage/armstorage/table_client.go b/sdk/resourcemanager/storage/armstorage/table_client.go index 8772a4e3f5d9..3ed209c715b2 100644 --- a/sdk/resourcemanager/storage/armstorage/table_client.go +++ b/sdk/resourcemanager/storage/armstorage/table_client.go @@ -55,10 +55,6 @@ func NewTableClient(subscriptionID string, credential azcore.TokenCredential, op // - options - TableClientCreateOptions contains the optional parameters for the TableClient.Create method. func (client *TableClient) Create(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientCreateOptions) (TableClientCreateResponse, error) { var err error - const operationName = "TableClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, tableName, options) if err != nil { return TableClientCreateResponse{}, err @@ -132,10 +128,6 @@ func (client *TableClient) createHandleResponse(resp *http.Response) (TableClien // - options - TableClientDeleteOptions contains the optional parameters for the TableClient.Delete method. func (client *TableClient) Delete(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientDeleteOptions) (TableClientDeleteResponse, error) { var err error - const operationName = "TableClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, tableName, options) if err != nil { return TableClientDeleteResponse{}, err @@ -193,10 +185,6 @@ func (client *TableClient) deleteCreateRequest(ctx context.Context, resourceGrou // - options - TableClientGetOptions contains the optional parameters for the TableClient.Get method. func (client *TableClient) Get(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientGetOptions) (TableClientGetResponse, error) { var err error - const operationName = "TableClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, tableName, options) if err != nil { return TableClientGetResponse{}, err @@ -265,7 +253,6 @@ func (client *TableClient) NewListPager(resourceGroupName string, accountName st return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *TableClientListResponse) (TableClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TableClient.NewListPager") var req *policy.Request var err error if page == nil { @@ -285,7 +272,6 @@ func (client *TableClient) NewListPager(resourceGroupName string, accountName st } return client.listHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } @@ -336,10 +322,6 @@ func (client *TableClient) listHandleResponse(resp *http.Response) (TableClientL // - options - TableClientUpdateOptions contains the optional parameters for the TableClient.Update method. func (client *TableClient) Update(ctx context.Context, resourceGroupName string, accountName string, tableName string, options *TableClientUpdateOptions) (TableClientUpdateResponse, error) { var err error - const operationName = "TableClient.Update" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, tableName, options) if err != nil { return TableClientUpdateResponse{}, err diff --git a/sdk/resourcemanager/storage/armstorage/tableservices_client.go b/sdk/resourcemanager/storage/armstorage/tableservices_client.go index bd288a9cfb40..d49623c31f30 100644 --- a/sdk/resourcemanager/storage/armstorage/tableservices_client.go +++ b/sdk/resourcemanager/storage/armstorage/tableservices_client.go @@ -55,10 +55,6 @@ func NewTableServicesClient(subscriptionID string, credential azcore.TokenCreden // method. func (client *TableServicesClient) GetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, options *TableServicesClientGetServicePropertiesOptions) (TableServicesClientGetServicePropertiesResponse, error) { var err error - const operationName = "TableServicesClient.GetServiceProperties" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.getServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return TableServicesClientGetServicePropertiesResponse{}, err @@ -121,10 +117,6 @@ func (client *TableServicesClient) getServicePropertiesHandleResponse(resp *http // - options - TableServicesClientListOptions contains the optional parameters for the TableServicesClient.List method. func (client *TableServicesClient) List(ctx context.Context, resourceGroupName string, accountName string, options *TableServicesClientListOptions) (TableServicesClientListResponse, error) { var err error - const operationName = "TableServicesClient.List" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { return TableServicesClientListResponse{}, err @@ -190,10 +182,6 @@ func (client *TableServicesClient) listHandleResponse(resp *http.Response) (Tabl // method. func (client *TableServicesClient) SetServiceProperties(ctx context.Context, resourceGroupName string, accountName string, parameters TableServiceProperties, options *TableServicesClientSetServicePropertiesOptions) (TableServicesClientSetServicePropertiesResponse, error) { var err error - const operationName = "TableServicesClient.SetServiceProperties" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() req, err := client.setServicePropertiesCreateRequest(ctx, resourceGroupName, accountName, parameters, options) if err != nil { return TableServicesClientSetServicePropertiesResponse{}, err diff --git a/sdk/resourcemanager/storage/armstorage/usages_client.go b/sdk/resourcemanager/storage/armstorage/usages_client.go index 596948504156..ebe18f0469c3 100644 --- a/sdk/resourcemanager/storage/armstorage/usages_client.go +++ b/sdk/resourcemanager/storage/armstorage/usages_client.go @@ -55,7 +55,6 @@ func (client *UsagesClient) NewListByLocationPager(location string, options *Usa return false }, Fetcher: func(ctx context.Context, page *UsagesClientListByLocationResponse) (UsagesClientListByLocationResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "UsagesClient.NewListByLocationPager") req, err := client.listByLocationCreateRequest(ctx, location, options) if err != nil { return UsagesClientListByLocationResponse{}, err @@ -69,7 +68,6 @@ func (client *UsagesClient) NewListByLocationPager(location string, options *Usa } return client.listByLocationHandleResponse(resp) }, - Tracer: client.internal.Tracer(), }) } From deca481a13e6c678d7fdaf033cec6a07a80f9779 Mon Sep 17 00:00:00 2001 From: Alancere <804873052@qq.com> Date: Wed, 23 Aug 2023 15:57:55 +0800 Subject: [PATCH 3/3] remove fake_example_test.go link stable version broken --- sdk/resourcemanager/storage/armstorage/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/resourcemanager/storage/armstorage/README.md b/sdk/resourcemanager/storage/armstorage/README.md index 3749d8070205..d55a2d64c97b 100644 --- a/sdk/resourcemanager/storage/armstorage/README.md +++ b/sdk/resourcemanager/storage/armstorage/README.md @@ -88,7 +88,6 @@ client, err := armstorage.NewAccountsClient("subscriptionID", azfake.NewTokenCre ## More sample code - [Blob](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/storage/blob) -- [Creating a Fake](https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/resourcemanager/storage/armstorage/fake_example_test.go) - [File](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/storage/file) - [Management Policy](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/storage/managementpolicy) - [Queue](https://aka.ms/azsdk/go/mgmt/samples?path=sdk/resourcemanager/storage/queue)