diff --git a/sdk/resourcemanager/storage/armstorage/CHANGELOG.md b/sdk/resourcemanager/storage/armstorage/CHANGELOG.md index 8d7cf597dcaf..c31c381595be 100644 --- a/sdk/resourcemanager/storage/armstorage/CHANGELOG.md +++ b/sdk/resourcemanager/storage/armstorage/CHANGELOG.md @@ -1,5 +1,30 @@ # Release History +## 2.0.0 (2022-11-11) +### Breaking Changes + +- Struct `CloudError` has been removed +- Struct `CloudErrorBody` has been removed + +### Features Added + +- New const `ListEncryptionScopesIncludeEnabled` +- New const `ListEncryptionScopesIncludeDisabled` +- New const `ListEncryptionScopesIncludeAll` +- New type alias `ListEncryptionScopesInclude` +- New function `PossibleListEncryptionScopesIncludeValues() []ListEncryptionScopesInclude` +- New field `TierToCold` in struct `ManagementPolicyBaseBlob` +- New field `TierToHot` in struct `ManagementPolicyBaseBlob` +- New field `TierToHot` in struct `ManagementPolicySnapShot` +- New field `TierToCold` in struct `ManagementPolicySnapShot` +- New field `Include` in struct `EncryptionScopesClientListOptions` +- New field `Maxpagesize` in struct `EncryptionScopesClientListOptions` +- New field `Filter` in struct `EncryptionScopesClientListOptions` +- New field `FailoverType` in struct `AccountsClientBeginFailoverOptions` +- New field `TierToHot` in struct `ManagementPolicyVersion` +- New field `TierToCold` in struct `ManagementPolicyVersion` + + ## 1.1.0 (2022-08-10) ### Features Added diff --git a/sdk/resourcemanager/storage/armstorage/accounts_client.go b/sdk/resourcemanager/storage/armstorage/accounts_client.go index a6524f6b560a..d1eeef99c937 100644 --- a/sdk/resourcemanager/storage/armstorage/accounts_client.go +++ b/sdk/resourcemanager/storage/armstorage/accounts_client.go @@ -57,7 +57,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-05-01 +// Generated from API version 2022-09-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. @@ -79,7 +79,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-05-01 +// Generated from API version 2022-09-01 func (client *AccountsClient) abortHierarchicalNamespaceMigration(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginAbortHierarchicalNamespaceMigrationOptions) (*http.Response, error) { req, err := client.abortHierarchicalNamespaceMigrationCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { @@ -115,7 +115,7 @@ func (client *AccountsClient) abortHierarchicalNamespaceMigrationCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -123,7 +123,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-05-01 +// Generated from API version 2022-09-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 @@ -155,7 +155,7 @@ func (client *AccountsClient) checkNameAvailabilityCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, accountName) @@ -175,7 +175,7 @@ func (client *AccountsClient) checkNameAvailabilityHandleResponse(resp *http.Res // will be updated. If an account is already created and a subsequent create or update request is issued with the exact same // set of properties, the request will succeed. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -198,7 +198,7 @@ func (client *AccountsClient) BeginCreate(ctx context.Context, resourceGroupName // will be updated. If an account is already created and a subsequent create or update request is issued with the exact same // set of properties, the request will succeed. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-01 func (client *AccountsClient) create(ctx context.Context, resourceGroupName string, accountName string, parameters AccountCreateParameters, options *AccountsClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, parameters, options) if err != nil { @@ -234,7 +234,7 @@ func (client *AccountsClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -242,7 +242,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-05-01 +// Generated from API version 2022-09-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. @@ -282,16 +282,22 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } -// BeginFailover - Failover request can be triggered for a storage account in case of availability issues. The failover occurs -// from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The -// secondary cluster will become primary after failover. +// BeginFailover - A failover request can be triggered for a storage account in the event a primary endpoint becomes unavailable +// for any reason. The failover occurs from the storage account's primary cluster to the +// secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover and the account is converted +// to LRS. In the case of a Planned Failover, the primary and secondary +// clusters are swapped after failover and the account remains geo-replicated. Failover should continue to be used in the +// event of availability issues as Planned failover is only available while the +// primary and secondary endpoints are available. The primary use case of a Planned Failover is disaster recovery testing +// drills. This type of failover is invoked by setting FailoverType parameter to +// '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-05-01 +// Generated from API version 2022-09-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,11 +316,17 @@ func (client *AccountsClient) BeginFailover(ctx context.Context, resourceGroupNa } } -// Failover - Failover request can be triggered for a storage account in case of availability issues. The failover occurs -// from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The -// secondary cluster will become primary after failover. +// Failover - A failover request can be triggered for a storage account in the event a primary endpoint becomes unavailable +// for any reason. The failover occurs from the storage account's primary cluster to the +// secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover and the account is converted +// to LRS. In the case of a Planned Failover, the primary and secondary +// clusters are swapped after failover and the account remains geo-replicated. Failover should continue to be used in the +// event of availability issues as Planned failover is only available while the +// primary and secondary endpoints are available. The primary use case of a Planned Failover is disaster recovery testing +// drills. This type of failover is invoked by setting FailoverType parameter to +// '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-05-01 +// Generated from API version 2022-09-01 func (client *AccountsClient) failover(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginFailoverOptions) (*http.Response, error) { req, err := client.failoverCreateRequest(ctx, resourceGroupName, accountName, options) if err != nil { @@ -350,7 +362,10 @@ func (client *AccountsClient) failoverCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") + if options != nil && options.FailoverType != nil { + reqQP.Set("failoverType", "Planned") + } req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -358,7 +373,7 @@ func (client *AccountsClient) failoverCreateRequest(ctx context.Context, resourc // 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-05-01 +// Generated from API version 2022-09-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. @@ -398,7 +413,7 @@ func (client *AccountsClient) getPropertiesCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } @@ -418,7 +433,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-05-01 +// Generated from API version 2022-09-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. @@ -443,7 +458,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-05-01 +// Generated from API version 2022-09-01 func (client *AccountsClient) hierarchicalNamespaceMigration(ctx context.Context, resourceGroupName string, accountName string, requestType string, options *AccountsClientBeginHierarchicalNamespaceMigrationOptions) (*http.Response, error) { req, err := client.hierarchicalNamespaceMigrationCreateRequest(ctx, resourceGroupName, accountName, requestType, options) if err != nil { @@ -479,7 +494,7 @@ func (client *AccountsClient) hierarchicalNamespaceMigrationCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") reqQP.Set("requestType", requestType) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} @@ -488,8 +503,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. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-01 // options - AccountsClientListOptions contains the optional parameters for the AccountsClient.List method. func (client *AccountsClient) NewListPager(options *AccountsClientListOptions) *runtime.Pager[AccountsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[AccountsClientListResponse]{ @@ -531,7 +545,7 @@ func (client *AccountsClient) listCreateRequest(ctx context.Context, options *Ac return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -548,7 +562,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-05-01 +// Generated from API version 2022-09-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. @@ -589,7 +603,7 @@ func (client *AccountsClient) listAccountSASCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -606,8 +620,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. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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.ListByResourceGroup // method. @@ -655,7 +668,7 @@ func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -672,7 +685,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-05-01 +// Generated from API version 2022-09-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. @@ -712,7 +725,7 @@ func (client *AccountsClient) listKeysCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", "kerb") } @@ -732,7 +745,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-05-01 +// Generated from API version 2022-09-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. @@ -773,7 +786,7 @@ func (client *AccountsClient) listServiceSASCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -790,7 +803,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-05-01 +// Generated from API version 2022-09-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. @@ -831,7 +844,7 @@ func (client *AccountsClient) regenerateKeyCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, regenerateKey) @@ -848,7 +861,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-05-01 +// Generated from API version 2022-09-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. @@ -871,7 +884,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-05-01 +// Generated from API version 2022-09-01 func (client *AccountsClient) restoreBlobRanges(ctx context.Context, resourceGroupName string, accountName string, parameters BlobRestoreParameters, options *AccountsClientBeginRestoreBlobRangesOptions) (*http.Response, error) { req, err := client.restoreBlobRangesCreateRequest(ctx, resourceGroupName, accountName, parameters, options) if err != nil { @@ -907,7 +920,7 @@ func (client *AccountsClient) restoreBlobRangesCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -915,7 +928,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-05-01 +// Generated from API version 2022-09-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. @@ -956,7 +969,7 @@ func (client *AccountsClient) revokeUserDelegationKeysCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -969,7 +982,7 @@ func (client *AccountsClient) revokeUserDelegationKeysCreateRequest(ctx context. // want to change the storage account keys, use the regenerate keys operation. The // 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-05-01 +// Generated from API version 2022-09-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. @@ -1010,7 +1023,7 @@ func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/storage/armstorage/accounts_client_example_test.go b/sdk/resourcemanager/storage/armstorage/accounts_client_example_test.go deleted file mode 100644 index 1afd174c36b5..000000000000 --- a/sdk/resourcemanager/storage/armstorage/accounts_client_example_test.go +++ /dev/null @@ -1,1541 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountCheckNameAvailability.json -func ExampleAccountsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, armstorage.AccountCheckNameAvailabilityParameters{ - Name: to.Ptr("sto3363"), - Type: to.Ptr("Microsoft.Storage/storageAccounts"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/NfsV3AccountCreate.json -func ExampleAccountsClient_BeginCreate_nfsV3AccountCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "res9101", "sto4445", armstorage.AccountCreateParameters{ - Kind: to.Ptr(armstorage.KindBlockBlobStorage), - Location: to.Ptr("eastus"), - Properties: &armstorage.AccountPropertiesCreateParameters{ - IsHnsEnabled: to.Ptr(true), - EnableNfsV3: to.Ptr(true), - NetworkRuleSet: &armstorage.NetworkRuleSet{ - Bypass: to.Ptr(armstorage.BypassAzureServices), - DefaultAction: to.Ptr(armstorage.DefaultActionAllow), - IPRules: []*armstorage.IPRule{}, - VirtualNetworkRules: []*armstorage.VirtualNetworkRule{ - { - VirtualNetworkResourceID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.Network/virtualNetworks/net123/subnets/subnet12"), - }}, - }, - EnableHTTPSTrafficOnly: to.Ptr(false), - }, - SKU: &armstorage.SKU{ - Name: to.Ptr(armstorage.SKUNamePremiumLRS), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountCreate.json -func ExampleAccountsClient_BeginCreate_storageAccountCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "res9101", "sto4445", armstorage.AccountCreateParameters{ - ExtendedLocation: &armstorage.ExtendedLocation{ - Name: to.Ptr("losangeles001"), - Type: to.Ptr(armstorage.ExtendedLocationTypesEdgeZone), - }, - Kind: to.Ptr(armstorage.KindStorage), - Location: to.Ptr("eastus"), - Properties: &armstorage.AccountPropertiesCreateParameters{ - AllowBlobPublicAccess: to.Ptr(false), - AllowSharedKeyAccess: to.Ptr(true), - DefaultToOAuthAuthentication: to.Ptr(false), - Encryption: &armstorage.Encryption{ - KeySource: to.Ptr(armstorage.KeySourceMicrosoftStorage), - RequireInfrastructureEncryption: to.Ptr(false), - Services: &armstorage.EncryptionServices{ - Blob: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - File: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - }, - }, - IsHnsEnabled: to.Ptr(true), - IsSftpEnabled: to.Ptr(true), - KeyPolicy: &armstorage.KeyPolicy{ - KeyExpirationPeriodInDays: to.Ptr[int32](20), - }, - MinimumTLSVersion: to.Ptr(armstorage.MinimumTLSVersionTLS12), - RoutingPreference: &armstorage.RoutingPreference{ - PublishInternetEndpoints: to.Ptr(true), - PublishMicrosoftEndpoints: to.Ptr(true), - RoutingChoice: to.Ptr(armstorage.RoutingChoiceMicrosoftRouting), - }, - SasPolicy: &armstorage.SasPolicy{ - ExpirationAction: to.Ptr(armstorage.ExpirationActionLog), - SasExpirationPeriod: to.Ptr("1.15:59:59"), - }, - }, - SKU: &armstorage.SKU{ - Name: to.Ptr(armstorage.SKUNameStandardGRS), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountCreateAllowedCopyScopeToAAD.json -func ExampleAccountsClient_BeginCreate_storageAccountCreateAllowedCopyScopeToAAD() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "res9101", "sto4445", armstorage.AccountCreateParameters{ - Kind: to.Ptr(armstorage.KindStorage), - Location: to.Ptr("eastus"), - Properties: &armstorage.AccountPropertiesCreateParameters{ - AllowBlobPublicAccess: to.Ptr(false), - AllowSharedKeyAccess: to.Ptr(true), - AllowedCopyScope: to.Ptr(armstorage.AllowedCopyScopeAAD), - Encryption: &armstorage.Encryption{ - KeySource: to.Ptr(armstorage.KeySourceMicrosoftStorage), - RequireInfrastructureEncryption: to.Ptr(false), - Services: &armstorage.EncryptionServices{ - Blob: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - File: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - }, - }, - IsHnsEnabled: to.Ptr(true), - KeyPolicy: &armstorage.KeyPolicy{ - KeyExpirationPeriodInDays: to.Ptr[int32](20), - }, - MinimumTLSVersion: to.Ptr(armstorage.MinimumTLSVersionTLS12), - RoutingPreference: &armstorage.RoutingPreference{ - PublishInternetEndpoints: to.Ptr(true), - PublishMicrosoftEndpoints: to.Ptr(true), - RoutingChoice: to.Ptr(armstorage.RoutingChoiceMicrosoftRouting), - }, - SasPolicy: &armstorage.SasPolicy{ - ExpirationAction: to.Ptr(armstorage.ExpirationActionLog), - SasExpirationPeriod: to.Ptr("1.15:59:59"), - }, - }, - SKU: &armstorage.SKU{ - Name: to.Ptr(armstorage.SKUNameStandardGRS), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountCreateAllowedCopyScopeToPrivateLink.json -func ExampleAccountsClient_BeginCreate_storageAccountCreateAllowedCopyScopeToPrivateLink() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "res9101", "sto4445", armstorage.AccountCreateParameters{ - Kind: to.Ptr(armstorage.KindStorage), - Location: to.Ptr("eastus"), - Properties: &armstorage.AccountPropertiesCreateParameters{ - AllowBlobPublicAccess: to.Ptr(false), - AllowSharedKeyAccess: to.Ptr(true), - AllowedCopyScope: to.Ptr(armstorage.AllowedCopyScopePrivateLink), - Encryption: &armstorage.Encryption{ - KeySource: to.Ptr(armstorage.KeySourceMicrosoftStorage), - RequireInfrastructureEncryption: to.Ptr(false), - Services: &armstorage.EncryptionServices{ - Blob: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - File: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - }, - }, - IsHnsEnabled: to.Ptr(true), - KeyPolicy: &armstorage.KeyPolicy{ - KeyExpirationPeriodInDays: to.Ptr[int32](20), - }, - MinimumTLSVersion: to.Ptr(armstorage.MinimumTLSVersionTLS12), - RoutingPreference: &armstorage.RoutingPreference{ - PublishInternetEndpoints: to.Ptr(true), - PublishMicrosoftEndpoints: to.Ptr(true), - RoutingChoice: to.Ptr(armstorage.RoutingChoiceMicrosoftRouting), - }, - SasPolicy: &armstorage.SasPolicy{ - ExpirationAction: to.Ptr(armstorage.ExpirationActionLog), - SasExpirationPeriod: to.Ptr("1.15:59:59"), - }, - }, - SKU: &armstorage.SKU{ - Name: to.Ptr(armstorage.SKUNameStandardGRS), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountCreateDisallowPublicNetworkAccess.json -func ExampleAccountsClient_BeginCreate_storageAccountCreateDisallowPublicNetworkAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "res9101", "sto4445", armstorage.AccountCreateParameters{ - ExtendedLocation: &armstorage.ExtendedLocation{ - Name: to.Ptr("losangeles001"), - Type: to.Ptr(armstorage.ExtendedLocationTypesEdgeZone), - }, - Kind: to.Ptr(armstorage.KindStorage), - Location: to.Ptr("eastus"), - Properties: &armstorage.AccountPropertiesCreateParameters{ - AllowBlobPublicAccess: to.Ptr(false), - AllowSharedKeyAccess: to.Ptr(true), - Encryption: &armstorage.Encryption{ - KeySource: to.Ptr(armstorage.KeySourceMicrosoftStorage), - RequireInfrastructureEncryption: to.Ptr(false), - Services: &armstorage.EncryptionServices{ - Blob: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - File: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - }, - }, - IsHnsEnabled: to.Ptr(true), - KeyPolicy: &armstorage.KeyPolicy{ - KeyExpirationPeriodInDays: to.Ptr[int32](20), - }, - MinimumTLSVersion: to.Ptr(armstorage.MinimumTLSVersionTLS12), - PublicNetworkAccess: to.Ptr(armstorage.PublicNetworkAccessDisabled), - RoutingPreference: &armstorage.RoutingPreference{ - PublishInternetEndpoints: to.Ptr(true), - PublishMicrosoftEndpoints: to.Ptr(true), - RoutingChoice: to.Ptr(armstorage.RoutingChoiceMicrosoftRouting), - }, - SasPolicy: &armstorage.SasPolicy{ - ExpirationAction: to.Ptr(armstorage.ExpirationActionLog), - SasExpirationPeriod: to.Ptr("1.15:59:59"), - }, - }, - SKU: &armstorage.SKU{ - Name: to.Ptr(armstorage.SKUNameStandardGRS), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountCreateDnsEndpointTypeToAzureDnsZone.json -func ExampleAccountsClient_BeginCreate_storageAccountCreateDnsEndpointTypeToAzureDnsZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "res9101", "sto4445", armstorage.AccountCreateParameters{ - ExtendedLocation: &armstorage.ExtendedLocation{ - Name: to.Ptr("losangeles001"), - Type: to.Ptr(armstorage.ExtendedLocationTypesEdgeZone), - }, - Kind: to.Ptr(armstorage.KindStorage), - Location: to.Ptr("eastus"), - Properties: &armstorage.AccountPropertiesCreateParameters{ - AllowBlobPublicAccess: to.Ptr(false), - AllowSharedKeyAccess: to.Ptr(true), - DefaultToOAuthAuthentication: to.Ptr(false), - DNSEndpointType: to.Ptr(armstorage.DNSEndpointTypeAzureDNSZone), - Encryption: &armstorage.Encryption{ - KeySource: to.Ptr(armstorage.KeySourceMicrosoftStorage), - RequireInfrastructureEncryption: to.Ptr(false), - Services: &armstorage.EncryptionServices{ - Blob: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - File: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - }, - }, - IsHnsEnabled: to.Ptr(true), - IsSftpEnabled: to.Ptr(true), - KeyPolicy: &armstorage.KeyPolicy{ - KeyExpirationPeriodInDays: to.Ptr[int32](20), - }, - MinimumTLSVersion: to.Ptr(armstorage.MinimumTLSVersionTLS12), - RoutingPreference: &armstorage.RoutingPreference{ - PublishInternetEndpoints: to.Ptr(true), - PublishMicrosoftEndpoints: to.Ptr(true), - RoutingChoice: to.Ptr(armstorage.RoutingChoiceMicrosoftRouting), - }, - SasPolicy: &armstorage.SasPolicy{ - ExpirationAction: to.Ptr(armstorage.ExpirationActionLog), - SasExpirationPeriod: to.Ptr("1.15:59:59"), - }, - }, - SKU: &armstorage.SKU{ - Name: to.Ptr(armstorage.SKUNameStandardGRS), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountCreateDnsEndpointTypeToStandard.json -func ExampleAccountsClient_BeginCreate_storageAccountCreateDnsEndpointTypeToStandard() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "res9101", "sto4445", armstorage.AccountCreateParameters{ - ExtendedLocation: &armstorage.ExtendedLocation{ - Name: to.Ptr("losangeles001"), - Type: to.Ptr(armstorage.ExtendedLocationTypesEdgeZone), - }, - Kind: to.Ptr(armstorage.KindStorage), - Location: to.Ptr("eastus"), - Properties: &armstorage.AccountPropertiesCreateParameters{ - AllowBlobPublicAccess: to.Ptr(false), - AllowSharedKeyAccess: to.Ptr(true), - DefaultToOAuthAuthentication: to.Ptr(false), - DNSEndpointType: to.Ptr(armstorage.DNSEndpointTypeStandard), - Encryption: &armstorage.Encryption{ - KeySource: to.Ptr(armstorage.KeySourceMicrosoftStorage), - RequireInfrastructureEncryption: to.Ptr(false), - Services: &armstorage.EncryptionServices{ - Blob: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - File: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - }, - }, - IsHnsEnabled: to.Ptr(true), - IsSftpEnabled: to.Ptr(true), - KeyPolicy: &armstorage.KeyPolicy{ - KeyExpirationPeriodInDays: to.Ptr[int32](20), - }, - MinimumTLSVersion: to.Ptr(armstorage.MinimumTLSVersionTLS12), - RoutingPreference: &armstorage.RoutingPreference{ - PublishInternetEndpoints: to.Ptr(true), - PublishMicrosoftEndpoints: to.Ptr(true), - RoutingChoice: to.Ptr(armstorage.RoutingChoiceMicrosoftRouting), - }, - SasPolicy: &armstorage.SasPolicy{ - ExpirationAction: to.Ptr(armstorage.ExpirationActionLog), - SasExpirationPeriod: to.Ptr("1.15:59:59"), - }, - }, - SKU: &armstorage.SKU{ - Name: to.Ptr(armstorage.SKUNameStandardGRS), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountCreateEnablePublicNetworkAccess.json -func ExampleAccountsClient_BeginCreate_storageAccountCreateEnablePublicNetworkAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "res9101", "sto4445", armstorage.AccountCreateParameters{ - ExtendedLocation: &armstorage.ExtendedLocation{ - Name: to.Ptr("losangeles001"), - Type: to.Ptr(armstorage.ExtendedLocationTypesEdgeZone), - }, - Kind: to.Ptr(armstorage.KindStorage), - Location: to.Ptr("eastus"), - Properties: &armstorage.AccountPropertiesCreateParameters{ - AllowBlobPublicAccess: to.Ptr(false), - AllowSharedKeyAccess: to.Ptr(true), - Encryption: &armstorage.Encryption{ - KeySource: to.Ptr(armstorage.KeySourceMicrosoftStorage), - RequireInfrastructureEncryption: to.Ptr(false), - Services: &armstorage.EncryptionServices{ - Blob: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - File: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - }, - }, - IsHnsEnabled: to.Ptr(true), - KeyPolicy: &armstorage.KeyPolicy{ - KeyExpirationPeriodInDays: to.Ptr[int32](20), - }, - MinimumTLSVersion: to.Ptr(armstorage.MinimumTLSVersionTLS12), - PublicNetworkAccess: to.Ptr(armstorage.PublicNetworkAccessEnabled), - RoutingPreference: &armstorage.RoutingPreference{ - PublishInternetEndpoints: to.Ptr(true), - PublishMicrosoftEndpoints: to.Ptr(true), - RoutingChoice: to.Ptr(armstorage.RoutingChoiceMicrosoftRouting), - }, - SasPolicy: &armstorage.SasPolicy{ - ExpirationAction: to.Ptr(armstorage.ExpirationActionLog), - SasExpirationPeriod: to.Ptr("1.15:59:59"), - }, - }, - SKU: &armstorage.SKU{ - Name: to.Ptr(armstorage.SKUNameStandardGRS), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountCreatePremiumBlockBlobStorage.json -func ExampleAccountsClient_BeginCreate_storageAccountCreatePremiumBlockBlobStorage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "res9101", "sto4445", armstorage.AccountCreateParameters{ - Kind: to.Ptr(armstorage.KindBlockBlobStorage), - Location: to.Ptr("eastus"), - Properties: &armstorage.AccountPropertiesCreateParameters{ - AllowSharedKeyAccess: to.Ptr(true), - Encryption: &armstorage.Encryption{ - KeySource: to.Ptr(armstorage.KeySourceMicrosoftStorage), - RequireInfrastructureEncryption: to.Ptr(false), - Services: &armstorage.EncryptionServices{ - Blob: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - File: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - }, - }, - MinimumTLSVersion: to.Ptr(armstorage.MinimumTLSVersionTLS12), - }, - SKU: &armstorage.SKU{ - Name: to.Ptr(armstorage.SKUNamePremiumLRS), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountCreateUserAssignedEncryptionIdentityWithCMK.json -func ExampleAccountsClient_BeginCreate_storageAccountCreateUserAssignedEncryptionIdentityWithCMK() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "res9101", "sto4445", armstorage.AccountCreateParameters{ - Identity: &armstorage.Identity{ - Type: to.Ptr(armstorage.IdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armstorage.UserAssignedIdentity{ - "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}": {}, - }, - }, - Kind: to.Ptr(armstorage.KindStorage), - Location: to.Ptr("eastus"), - Properties: &armstorage.AccountPropertiesCreateParameters{ - Encryption: &armstorage.Encryption{ - EncryptionIdentity: &armstorage.EncryptionIdentity{ - EncryptionUserAssignedIdentity: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}"), - }, - KeySource: to.Ptr(armstorage.KeySourceMicrosoftKeyvault), - KeyVaultProperties: &armstorage.KeyVaultProperties{ - KeyName: to.Ptr("wrappingKey"), - KeyVaultURI: to.Ptr("https://myvault8569.vault.azure.net"), - KeyVersion: to.Ptr(""), - }, - Services: &armstorage.EncryptionServices{ - Blob: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - File: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - }, - }, - }, - SKU: &armstorage.SKU{ - Name: to.Ptr(armstorage.SKUNameStandardLRS), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.json -func ExampleAccountsClient_BeginCreate_storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "res131918", "sto131918", armstorage.AccountCreateParameters{ - Identity: &armstorage.Identity{ - Type: to.Ptr(armstorage.IdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armstorage.UserAssignedIdentity{ - "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}": {}, - }, - }, - Kind: to.Ptr(armstorage.KindStorage), - Location: to.Ptr("eastus"), - Properties: &armstorage.AccountPropertiesCreateParameters{ - Encryption: &armstorage.Encryption{ - EncryptionIdentity: &armstorage.EncryptionIdentity{ - EncryptionFederatedIdentityClientID: to.Ptr("f83c6b1b-4d34-47e4-bb34-9d83df58b540"), - EncryptionUserAssignedIdentity: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}"), - }, - KeySource: to.Ptr(armstorage.KeySourceMicrosoftKeyvault), - KeyVaultProperties: &armstorage.KeyVaultProperties{ - KeyName: to.Ptr("wrappingKey"), - KeyVaultURI: to.Ptr("https://myvault8569.vault.azure.net"), - KeyVersion: to.Ptr(""), - }, - Services: &armstorage.EncryptionServices{ - Blob: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - File: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - }, - }, - }, - SKU: &armstorage.SKU{ - Name: to.Ptr(armstorage.SKUNameStandardLRS), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountCreateWithImmutabilityPolicy.json -func ExampleAccountsClient_BeginCreate_storageAccountCreateWithImmutabilityPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, "res9101", "sto4445", armstorage.AccountCreateParameters{ - ExtendedLocation: &armstorage.ExtendedLocation{ - Name: to.Ptr("losangeles001"), - Type: to.Ptr(armstorage.ExtendedLocationTypesEdgeZone), - }, - Kind: to.Ptr(armstorage.KindStorage), - Location: to.Ptr("eastus"), - Properties: &armstorage.AccountPropertiesCreateParameters{ - ImmutableStorageWithVersioning: &armstorage.ImmutableStorageAccount{ - Enabled: to.Ptr(true), - ImmutabilityPolicy: &armstorage.AccountImmutabilityPolicyProperties{ - AllowProtectedAppendWrites: to.Ptr(true), - ImmutabilityPeriodSinceCreationInDays: to.Ptr[int32](15), - State: to.Ptr(armstorage.AccountImmutabilityPolicyStateUnlocked), - }, - }, - }, - SKU: &armstorage.SKU{ - Name: to.Ptr(armstorage.SKUNameStandardGRS), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountDelete.json -func ExampleAccountsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "res4228", "sto2434", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountGetAsyncSkuConversionStatus.json -func ExampleAccountsClient_GetProperties_storageAccountGetAsyncSkuConversionStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetProperties(ctx, "res9407", "sto8596", &armstorage.AccountsClientGetPropertiesOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountGetProperties.json -func ExampleAccountsClient_GetProperties_storageAccountGetProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetProperties(ctx, "res9407", "sto8596", &armstorage.AccountsClientGetPropertiesOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountGetPropertiesCMKEnabled.json -func ExampleAccountsClient_GetProperties_storageAccountGetPropertiesCMKEnabled() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetProperties(ctx, "res9407", "sto8596", &armstorage.AccountsClientGetPropertiesOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountGetPropertiesCMKVersionExpirationTime.json -func ExampleAccountsClient_GetProperties_storageAccountGetPropertiesCMKVersionExpirationTime() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetProperties(ctx, "res9407", "sto8596", &armstorage.AccountsClientGetPropertiesOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountEnableAD.json -func ExampleAccountsClient_Update_storageAccountEnableAD() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "res9407", "sto8596", armstorage.AccountUpdateParameters{ - Properties: &armstorage.AccountPropertiesUpdateParameters{ - AzureFilesIdentityBasedAuthentication: &armstorage.AzureFilesIdentityBasedAuthentication{ - ActiveDirectoryProperties: &armstorage.ActiveDirectoryProperties{ - AccountType: to.Ptr(armstorage.ActiveDirectoryPropertiesAccountTypeUser), - AzureStorageSid: to.Ptr("S-1-5-21-2400535526-2334094090-2402026252-0012"), - DomainGUID: to.Ptr("aebfc118-9fa9-4732-a21f-d98e41a77ae1"), - DomainName: to.Ptr("adtest.com"), - DomainSid: to.Ptr("S-1-5-21-2400535526-2334094090-2402026252"), - ForestName: to.Ptr("adtest.com"), - NetBiosDomainName: to.Ptr("adtest.com"), - SamAccountName: to.Ptr("sam12498"), - }, - DirectoryServiceOptions: to.Ptr(armstorage.DirectoryServiceOptionsAD), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountEnableCMK.json -func ExampleAccountsClient_Update_storageAccountEnableCMK() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "res9407", "sto8596", armstorage.AccountUpdateParameters{ - Properties: &armstorage.AccountPropertiesUpdateParameters{ - Encryption: &armstorage.Encryption{ - KeySource: to.Ptr(armstorage.KeySourceMicrosoftKeyvault), - KeyVaultProperties: &armstorage.KeyVaultProperties{ - KeyName: to.Ptr("wrappingKey"), - KeyVaultURI: to.Ptr("https://myvault8569.vault.azure.net"), - KeyVersion: to.Ptr(""), - }, - Services: &armstorage.EncryptionServices{ - Blob: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - File: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountUpdate.json -func ExampleAccountsClient_Update_storageAccountUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "res9407", "sto8596", armstorage.AccountUpdateParameters{ - Properties: &armstorage.AccountPropertiesUpdateParameters{ - AllowBlobPublicAccess: to.Ptr(false), - AllowSharedKeyAccess: to.Ptr(true), - DefaultToOAuthAuthentication: to.Ptr(false), - Encryption: &armstorage.Encryption{ - KeySource: to.Ptr(armstorage.KeySourceMicrosoftStorage), - Services: &armstorage.EncryptionServices{ - Blob: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - File: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - }, - }, - IsLocalUserEnabled: to.Ptr(true), - IsSftpEnabled: to.Ptr(true), - KeyPolicy: &armstorage.KeyPolicy{ - KeyExpirationPeriodInDays: to.Ptr[int32](20), - }, - MinimumTLSVersion: to.Ptr(armstorage.MinimumTLSVersionTLS12), - NetworkRuleSet: &armstorage.NetworkRuleSet{ - DefaultAction: to.Ptr(armstorage.DefaultActionAllow), - 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"), - }}, - }, - RoutingPreference: &armstorage.RoutingPreference{ - PublishInternetEndpoints: to.Ptr(true), - PublishMicrosoftEndpoints: to.Ptr(true), - RoutingChoice: to.Ptr(armstorage.RoutingChoiceMicrosoftRouting), - }, - SasPolicy: &armstorage.SasPolicy{ - ExpirationAction: to.Ptr(armstorage.ExpirationActionLog), - SasExpirationPeriod: to.Ptr("1.15:59:59"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountUpdateAllowedCopyScopeToAAD.json -func ExampleAccountsClient_Update_storageAccountUpdateAllowedCopyScopeToAAD() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "res9407", "sto8596", armstorage.AccountUpdateParameters{ - Properties: &armstorage.AccountPropertiesUpdateParameters{ - AllowBlobPublicAccess: to.Ptr(false), - AllowSharedKeyAccess: to.Ptr(true), - AllowedCopyScope: to.Ptr(armstorage.AllowedCopyScopeAAD), - Encryption: &armstorage.Encryption{ - KeySource: to.Ptr(armstorage.KeySourceMicrosoftStorage), - Services: &armstorage.EncryptionServices{ - Blob: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - File: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - }, - }, - KeyPolicy: &armstorage.KeyPolicy{ - KeyExpirationPeriodInDays: to.Ptr[int32](20), - }, - MinimumTLSVersion: to.Ptr(armstorage.MinimumTLSVersionTLS12), - NetworkRuleSet: &armstorage.NetworkRuleSet{ - DefaultAction: to.Ptr(armstorage.DefaultActionAllow), - 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"), - }}, - }, - RoutingPreference: &armstorage.RoutingPreference{ - PublishInternetEndpoints: to.Ptr(true), - PublishMicrosoftEndpoints: to.Ptr(true), - RoutingChoice: to.Ptr(armstorage.RoutingChoiceMicrosoftRouting), - }, - SasPolicy: &armstorage.SasPolicy{ - ExpirationAction: to.Ptr(armstorage.ExpirationActionLog), - SasExpirationPeriod: to.Ptr("1.15:59:59"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountUpdateDisablePublicNetworkAccess.json -func ExampleAccountsClient_Update_storageAccountUpdateDisablePublicNetworkAccess() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "res9407", "sto8596", armstorage.AccountUpdateParameters{ - Properties: &armstorage.AccountPropertiesUpdateParameters{ - AllowBlobPublicAccess: to.Ptr(false), - AllowSharedKeyAccess: to.Ptr(true), - Encryption: &armstorage.Encryption{ - KeySource: to.Ptr(armstorage.KeySourceMicrosoftStorage), - Services: &armstorage.EncryptionServices{ - Blob: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - File: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - }, - }, - KeyPolicy: &armstorage.KeyPolicy{ - KeyExpirationPeriodInDays: to.Ptr[int32](20), - }, - MinimumTLSVersion: to.Ptr(armstorage.MinimumTLSVersionTLS12), - NetworkRuleSet: &armstorage.NetworkRuleSet{ - DefaultAction: to.Ptr(armstorage.DefaultActionAllow), - 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"), - }}, - }, - PublicNetworkAccess: to.Ptr(armstorage.PublicNetworkAccessDisabled), - RoutingPreference: &armstorage.RoutingPreference{ - PublishInternetEndpoints: to.Ptr(true), - PublishMicrosoftEndpoints: to.Ptr(true), - RoutingChoice: to.Ptr(armstorage.RoutingChoiceMicrosoftRouting), - }, - SasPolicy: &armstorage.SasPolicy{ - ExpirationAction: to.Ptr(armstorage.ExpirationActionLog), - SasExpirationPeriod: to.Ptr("1.15:59:59"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountUpdateUserAssignedEncryptionIdentityWithCMK.json -func ExampleAccountsClient_Update_storageAccountUpdateUserAssignedEncryptionIdentityWithCMK() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "res9101", "sto4445", armstorage.AccountUpdateParameters{ - Identity: &armstorage.Identity{ - Type: to.Ptr(armstorage.IdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armstorage.UserAssignedIdentity{ - "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}": {}, - }, - }, - Kind: to.Ptr(armstorage.KindStorage), - Properties: &armstorage.AccountPropertiesUpdateParameters{ - Encryption: &armstorage.Encryption{ - EncryptionIdentity: &armstorage.EncryptionIdentity{ - EncryptionUserAssignedIdentity: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}"), - }, - KeySource: to.Ptr(armstorage.KeySourceMicrosoftKeyvault), - KeyVaultProperties: &armstorage.KeyVaultProperties{ - KeyName: to.Ptr("wrappingKey"), - KeyVaultURI: to.Ptr("https://myvault8569.vault.azure.net"), - KeyVersion: to.Ptr(""), - }, - Services: &armstorage.EncryptionServices{ - Blob: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - File: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - }, - }, - }, - SKU: &armstorage.SKU{ - Name: to.Ptr(armstorage.SKUNameStandardLRS), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.json -func ExampleAccountsClient_Update_storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "res131918", "sto131918", armstorage.AccountUpdateParameters{ - Identity: &armstorage.Identity{ - Type: to.Ptr(armstorage.IdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armstorage.UserAssignedIdentity{ - "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}": {}, - }, - }, - Kind: to.Ptr(armstorage.KindStorage), - Properties: &armstorage.AccountPropertiesUpdateParameters{ - Encryption: &armstorage.Encryption{ - EncryptionIdentity: &armstorage.EncryptionIdentity{ - EncryptionFederatedIdentityClientID: to.Ptr("3109d1c4-a5de-4d84-8832-feabb916a4b6"), - EncryptionUserAssignedIdentity: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}"), - }, - KeySource: to.Ptr(armstorage.KeySourceMicrosoftKeyvault), - KeyVaultProperties: &armstorage.KeyVaultProperties{ - KeyName: to.Ptr("wrappingKey"), - KeyVaultURI: to.Ptr("https://myvault8569.vault.azure.net"), - KeyVersion: to.Ptr(""), - }, - Services: &armstorage.EncryptionServices{ - Blob: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - File: &armstorage.EncryptionService{ - Enabled: to.Ptr(true), - KeyType: to.Ptr(armstorage.KeyTypeAccount), - }, - }, - }, - }, - SKU: &armstorage.SKU{ - Name: to.Ptr(armstorage.SKUNameStandardLRS), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountUpdateWithImmutabilityPolicy.json -func ExampleAccountsClient_Update_storageAccountUpdateWithImmutabilityPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "res9407", "sto8596", armstorage.AccountUpdateParameters{ - Properties: &armstorage.AccountPropertiesUpdateParameters{ - ImmutableStorageWithVersioning: &armstorage.ImmutableStorageAccount{ - Enabled: to.Ptr(true), - ImmutabilityPolicy: &armstorage.AccountImmutabilityPolicyProperties{ - AllowProtectedAppendWrites: to.Ptr(true), - ImmutabilityPeriodSinceCreationInDays: to.Ptr[int32](15), - State: to.Ptr(armstorage.AccountImmutabilityPolicyStateLocked), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountList.json -func ExampleAccountsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountListByResourceGroup.json -func ExampleAccountsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("res6117", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountListKeys.json -func ExampleAccountsClient_ListKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListKeys(ctx, "res418", "sto2220", &armstorage.AccountsClientListKeysOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountRegenerateKerbKey.json -func ExampleAccountsClient_RegenerateKey_storageAccountRegenerateKerbKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.RegenerateKey(ctx, "res4167", "sto3539", armstorage.AccountRegenerateKeyParameters{ - KeyName: to.Ptr("kerb1"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountRegenerateKey.json -func ExampleAccountsClient_RegenerateKey_storageAccountRegenerateKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.RegenerateKey(ctx, "res4167", "sto3539", armstorage.AccountRegenerateKeyParameters{ - KeyName: to.Ptr("key2"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountListAccountSAS.json -func ExampleAccountsClient_ListAccountSAS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListAccountSAS(ctx, "res7985", "sto8588", armstorage.AccountSasParameters{ - KeyToSign: to.Ptr("key1"), - SharedAccessExpiryTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-24T11:42:03.1567373Z"); return t }()), - Permissions: to.Ptr(armstorage.PermissionsR), - Protocols: to.Ptr(armstorage.HTTPProtocolHTTPSHTTP), - ResourceTypes: to.Ptr(armstorage.SignedResourceTypesS), - Services: to.Ptr(armstorage.ServicesB), - SharedAccessStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-24T10:42:03.1567373Z"); return t }()), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountListServiceSAS.json -func ExampleAccountsClient_ListServiceSAS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListServiceSAS(ctx, "res7439", "sto1299", armstorage.ServiceSasParameters{ - CanonicalizedResource: to.Ptr("/blob/sto1299/music"), - SharedAccessExpiryTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-24T11:32:48.8457197Z"); return t }()), - Permissions: to.Ptr(armstorage.PermissionsL), - Resource: to.Ptr(armstorage.SignedResourceC), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountFailover.json -func ExampleAccountsClient_BeginFailover() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginFailover(ctx, "res4228", "sto2434", 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/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountHierarchicalNamespaceMigration.json -func ExampleAccountsClient_BeginHierarchicalNamespaceMigration() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginHierarchicalNamespaceMigration(ctx, "res4228", "sto2434", "HnsOnValidationRequest", 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/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountAbortHierarchicalNamespaceMigration.json -func ExampleAccountsClient_BeginAbortHierarchicalNamespaceMigration() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginAbortHierarchicalNamespaceMigration(ctx, "res4228", "sto2434", 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/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobRangesRestore.json -func ExampleAccountsClient_BeginRestoreBlobRanges() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRestoreBlobRanges(ctx, "res9101", "sto4445", armstorage.BlobRestoreParameters{ - BlobRanges: []*armstorage.BlobRestoreRange{ - { - EndRange: to.Ptr("container/blobpath2"), - StartRange: to.Ptr("container/blobpath1"), - }, - { - EndRange: to.Ptr(""), - StartRange: to.Ptr("container2/blobpath3"), - }}, - TimeToRestore: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-20T15:30:00.0000000Z"); return t }()), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountRevokeUserDelegationKeys.json -func ExampleAccountsClient_RevokeUserDelegationKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.RevokeUserDelegationKeys(ctx, "res4167", "sto3539", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/storage/armstorage/autorest.md b/sdk/resourcemanager/storage/armstorage/autorest.md index ac98c0a62c49..7c4d603140f5 100644 --- a/sdk/resourcemanager/storage/armstorage/autorest.md +++ b/sdk/resourcemanager/storage/armstorage/autorest.md @@ -5,10 +5,10 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/124789ad0942fcafded1c1dbd6d2a703b23d10c7/specification/storage/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/124789ad0942fcafded1c1dbd6d2a703b23d10c7/specification/storage/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/storage/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/storage/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0 +module-version: 2.0.0 modelerfour: seal-single-value-enum-by-default: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go b/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go index 08a08eb130c0..165662fed15c 100644 --- a/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go +++ b/sdk/resourcemanager/storage/armstorage/blobcontainers_client.go @@ -58,7 +58,7 @@ func NewBlobContainersClient(subscriptionID string, credential azcore.TokenCrede // ClearLegalHold - Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold // clears out only the specified tags in the request. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -107,7 +107,7 @@ func (client *BlobContainersClient) clearLegalHoldCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, legalHold) @@ -126,7 +126,7 @@ func (client *BlobContainersClient) clearLegalHoldHandleResponse(resp *http.Resp // metadata and properties for that container. It does not include a list of the blobs // contained by the container. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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 *BlobContainersClient) createCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, blobContainer) @@ -192,7 +192,7 @@ func (client *BlobContainersClient) createHandleResponse(resp *http.Response) (B // CreateOrUpdateImmutabilityPolicy - Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given // but not required for this operation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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 *BlobContainersClient) createOrUpdateImmutabilityPolicyCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -267,7 +267,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-05-01 +// Generated from API version 2022-09-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. @@ -314,7 +314,7 @@ func (client *BlobContainersClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -324,7 +324,7 @@ func (client *BlobContainersClient) deleteCreateRequest(ctx context.Context, res // policy is not allowed, the only way is to delete the container after deleting all expired blobs inside the policy locked // container. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -376,7 +376,7 @@ func (client *BlobContainersClient) deleteImmutabilityPolicyCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -398,7 +398,7 @@ func (client *BlobContainersClient) deleteImmutabilityPolicyHandleResponse(resp // ExtendImmutabilityPolicy - Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action // 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-05-01 +// Generated from API version 2022-09-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. @@ -449,7 +449,7 @@ func (client *BlobContainersClient) extendImmutabilityPolicyCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -473,7 +473,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-05-01 +// Generated from API version 2022-09-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. @@ -520,7 +520,7 @@ func (client *BlobContainersClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -538,7 +538,7 @@ func (client *BlobContainersClient) getHandleResponse(resp *http.Response) (Blob // GetImmutabilityPolicy - Gets the existing immutability policy along with the corresponding ETag in response headers and // body. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -587,7 +587,7 @@ func (client *BlobContainersClient) getImmutabilityPolicyCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -611,7 +611,7 @@ func (client *BlobContainersClient) getImmutabilityPolicyHandleResponse(resp *ht // Lease - The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration // 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-05-01 +// Generated from API version 2022-09-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. @@ -658,7 +658,7 @@ func (client *BlobContainersClient) leaseCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Parameters != nil { @@ -678,8 +678,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. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -732,7 +731,7 @@ func (client *BlobContainersClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") if options != nil && options.Maxpagesize != nil { reqQP.Set("$maxpagesize", *options.Maxpagesize) } @@ -759,7 +758,7 @@ func (client *BlobContainersClient) listHandleResponse(resp *http.Response) (Blo // LockImmutabilityPolicy - Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy // 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-05-01 +// Generated from API version 2022-09-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. @@ -810,7 +809,7 @@ func (client *BlobContainersClient) lockImmutabilityPolicyCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["If-Match"] = []string{ifMatch} req.Raw().Header["Accept"] = []string{"application/json"} @@ -833,7 +832,7 @@ func (client *BlobContainersClient) lockImmutabilityPolicyHandleResponse(resp *h // enabled container. Prerequisites require a container level immutability policy either in locked or // 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-05-01 +// Generated from API version 2022-09-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. @@ -860,7 +859,7 @@ func (client *BlobContainersClient) BeginObjectLevelWorm(ctx context.Context, re // container. Prerequisites require a container level immutability policy either in locked or // 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-05-01 +// Generated from API version 2022-09-01 func (client *BlobContainersClient) objectLevelWorm(ctx context.Context, resourceGroupName string, accountName string, containerName string, options *BlobContainersClientBeginObjectLevelWormOptions) (*http.Response, error) { req, err := client.objectLevelWormCreateRequest(ctx, resourceGroupName, accountName, containerName, options) if err != nil { @@ -900,7 +899,7 @@ func (client *BlobContainersClient) objectLevelWormCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -909,7 +908,7 @@ func (client *BlobContainersClient) objectLevelWormCreateRequest(ctx context.Con // SetLegalHold - Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append // 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-05-01 +// Generated from API version 2022-09-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. @@ -958,7 +957,7 @@ func (client *BlobContainersClient) setLegalHoldCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, legalHold) @@ -976,7 +975,7 @@ func (client *BlobContainersClient) setLegalHoldHandleResponse(resp *http.Respon // Update - Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. // 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-05-01 +// Generated from API version 2022-09-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. @@ -1024,7 +1023,7 @@ func (client *BlobContainersClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, blobContainer) diff --git a/sdk/resourcemanager/storage/armstorage/blobcontainers_client_example_test.go b/sdk/resourcemanager/storage/armstorage/blobcontainers_client_example_test.go deleted file mode 100644 index 1047b148e942..000000000000 --- a/sdk/resourcemanager/storage/armstorage/blobcontainers_client_example_test.go +++ /dev/null @@ -1,494 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersList.json -func ExampleBlobContainersClient_NewListPager_blobContainersList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("res9290", "sto1590", &armstorage.BlobContainersClientListOptions{Maxpagesize: nil, - Filter: nil, - Include: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/DeletedBlobContainersList.json -func ExampleBlobContainersClient_NewListPager_deletedBlobContainersList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("res9290", "sto1590", &armstorage.BlobContainersClientListOptions{Maxpagesize: nil, - Filter: nil, - Include: to.Ptr(armstorage.ListContainersIncludeDeleted), - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersPutDefaultEncryptionScope.json -func ExampleBlobContainersClient_Create_blobContainersPutDefaultEncryptionScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, "res3376", "sto328", "container6185", armstorage.BlobContainer{ - ContainerProperties: &armstorage.ContainerProperties{ - DefaultEncryptionScope: to.Ptr("encryptionscope185"), - DenyEncryptionScopeOverride: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersPutObjectLevelWorm.json -func ExampleBlobContainersClient_Create_blobContainersPutObjectLevelWorm() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, "res3376", "sto328", "container6185", armstorage.BlobContainer{ - ContainerProperties: &armstorage.ContainerProperties{ - ImmutableStorageWithVersioning: &armstorage.ImmutableStorageWithVersioning{ - Enabled: to.Ptr(true), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersPut.json -func ExampleBlobContainersClient_Create_blobContainersPut() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, "res3376", "sto328", "container6185", armstorage.BlobContainer{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersPatch.json -func ExampleBlobContainersClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "res3376", "sto328", "container6185", armstorage.BlobContainer{ - ContainerProperties: &armstorage.ContainerProperties{ - Metadata: map[string]*string{ - "metadata": to.Ptr("true"), - }, - PublicAccess: to.Ptr(armstorage.PublicAccessContainer), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersGetWithAllowProtectedAppendWritesAll.json -func ExampleBlobContainersClient_Get_blobContainersGetWithAllowProtectedAppendWritesAll() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "res9871", "sto6217", "container1634", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersGet.json -func ExampleBlobContainersClient_Get_blobContainersGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "res9871", "sto6217", "container1634", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersDelete.json -func ExampleBlobContainersClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "res4079", "sto4506", "container9689", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersSetLegalHold.json -func ExampleBlobContainersClient_SetLegalHold_blobContainersSetLegalHold() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.SetLegalHold(ctx, "res4303", "sto7280", "container8723", armstorage.LegalHold{ - Tags: []*string{ - to.Ptr("tag1"), - to.Ptr("tag2"), - to.Ptr("tag3")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersSetLegalHoldAllowProtectedAppendWritesAll.json -func ExampleBlobContainersClient_SetLegalHold_blobContainersSetLegalHoldAllowProtectedAppendWritesAll() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.SetLegalHold(ctx, "res4303", "sto7280", "container8723", armstorage.LegalHold{ - AllowProtectedAppendWritesAll: to.Ptr(true), - Tags: []*string{ - to.Ptr("tag1"), - to.Ptr("tag2"), - to.Ptr("tag3")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersClearLegalHold.json -func ExampleBlobContainersClient_ClearLegalHold() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ClearLegalHold(ctx, "res4303", "sto7280", "container8723", armstorage.LegalHold{ - Tags: []*string{ - to.Ptr("tag1"), - to.Ptr("tag2"), - to.Ptr("tag3")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersPutImmutabilityPolicy.json -func ExampleBlobContainersClient_CreateOrUpdateImmutabilityPolicy_blobContainersPutImmutabilityPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdateImmutabilityPolicy(ctx, "res1782", "sto7069", "container6397", &armstorage.BlobContainersClientCreateOrUpdateImmutabilityPolicyOptions{IfMatch: nil, - Parameters: &armstorage.ImmutabilityPolicy{ - Properties: &armstorage.ImmutabilityPolicyProperty{ - AllowProtectedAppendWrites: to.Ptr(true), - ImmutabilityPeriodSinceCreationInDays: to.Ptr[int32](3), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersPutImmutabilityPolicyAllowProtectedAppendWritesAll.json -func ExampleBlobContainersClient_CreateOrUpdateImmutabilityPolicy_blobContainersPutImmutabilityPolicyAllowProtectedAppendWritesAll() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdateImmutabilityPolicy(ctx, "res1782", "sto7069", "container6397", &armstorage.BlobContainersClientCreateOrUpdateImmutabilityPolicyOptions{IfMatch: nil, - Parameters: &armstorage.ImmutabilityPolicy{ - Properties: &armstorage.ImmutabilityPolicyProperty{ - AllowProtectedAppendWritesAll: to.Ptr(true), - ImmutabilityPeriodSinceCreationInDays: to.Ptr[int32](3), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersGetImmutabilityPolicy.json -func ExampleBlobContainersClient_GetImmutabilityPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetImmutabilityPolicy(ctx, "res5221", "sto9177", "container3489", &armstorage.BlobContainersClientGetImmutabilityPolicyOptions{IfMatch: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersDeleteImmutabilityPolicy.json -func ExampleBlobContainersClient_DeleteImmutabilityPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.DeleteImmutabilityPolicy(ctx, "res1581", "sto9621", "container4910", "\"8d59f81a7fa7be0\"", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersLockImmutabilityPolicy.json -func ExampleBlobContainersClient_LockImmutabilityPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.LockImmutabilityPolicy(ctx, "res2702", "sto5009", "container1631", "\"8d59f825b721dd3\"", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersExtendImmutabilityPolicy.json -func ExampleBlobContainersClient_ExtendImmutabilityPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ExtendImmutabilityPolicy(ctx, "res6238", "sto232", "container5023", "\"8d59f830d0c3bf9\"", &armstorage.BlobContainersClientExtendImmutabilityPolicyOptions{Parameters: &armstorage.ImmutabilityPolicy{ - Properties: &armstorage.ImmutabilityPolicyProperty{ - ImmutabilityPeriodSinceCreationInDays: to.Ptr[int32](100), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersLease_Acquire.json -func ExampleBlobContainersClient_Lease_blobContainersLease_Acquire() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Lease(ctx, "res3376", "sto328", "container6185", &armstorage.BlobContainersClientLeaseOptions{Parameters: &armstorage.LeaseContainerRequest{ - Action: to.Ptr(armstorage.LeaseContainerRequestActionAcquire), - LeaseDuration: to.Ptr[int32](-1), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobContainersLease_Break.json -func ExampleBlobContainersClient_Lease_blobContainersLease_Break() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Lease(ctx, "res3376", "sto328", "container6185", &armstorage.BlobContainersClientLeaseOptions{Parameters: &armstorage.LeaseContainerRequest{ - Action: to.Ptr(armstorage.LeaseContainerRequestActionBreak), - LeaseID: to.Ptr("8698f513-fa75-44a1-b8eb-30ba336af27d"), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/ObjectLevelWormContainerMigration.json -func ExampleBlobContainersClient_BeginObjectLevelWorm() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobContainersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginObjectLevelWorm(ctx, "res1782", "sto7069", "container6397", 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) - } -} diff --git a/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go b/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go index 4e46332b7b0d..e434ec5fdcb6 100644 --- a/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go +++ b/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client.go @@ -57,7 +57,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-05-01 +// Generated from API version 2022-09-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. @@ -104,7 +104,7 @@ func (client *BlobInventoryPoliciesClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, properties) @@ -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-05-01 +// Generated from API version 2022-09-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. @@ -167,7 +167,7 @@ func (client *BlobInventoryPoliciesClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -175,7 +175,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-05-01 +// Generated from API version 2022-09-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. @@ -221,7 +221,7 @@ func (client *BlobInventoryPoliciesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -237,8 +237,7 @@ func (client *BlobInventoryPoliciesClient) getHandleResponse(resp *http.Response } // NewListPager - 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-05-01 +// Generated from API version 2022-09-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. @@ -286,7 +285,7 @@ func (client *BlobInventoryPoliciesClient) listCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-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 deleted file mode 100644 index 667d893d1a91..000000000000 --- a/sdk/resourcemanager/storage/armstorage/blobinventorypolicies_client_example_test.go +++ /dev/null @@ -1,365 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountGetBlobInventoryPolicy.json -func ExampleBlobInventoryPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobInventoryPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "res7687", "sto9699", armstorage.BlobInventoryPolicyNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountSetBlobInventoryPolicy.json -func ExampleBlobInventoryPoliciesClient_CreateOrUpdate_storageAccountSetBlobInventoryPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobInventoryPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "res7687", "sto9699", armstorage.BlobInventoryPolicyNameDefault, armstorage.BlobInventoryPolicy{ - Properties: &armstorage.BlobInventoryPolicyProperties{ - Policy: &armstorage.BlobInventoryPolicySchema{ - Type: to.Ptr(armstorage.InventoryRuleTypeInventory), - Enabled: to.Ptr(true), - Rules: []*armstorage.BlobInventoryPolicyRule{ - { - Name: to.Ptr("inventoryPolicyRule1"), - Definition: &armstorage.BlobInventoryPolicyDefinition{ - Format: to.Ptr(armstorage.FormatCSV), - Filters: &armstorage.BlobInventoryPolicyFilter{ - BlobTypes: []*string{ - 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), - 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("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), - }}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountSetBlobInventoryPolicyIncludeDeleteAndNewSchemaForHnsAccount.json -func ExampleBlobInventoryPoliciesClient_CreateOrUpdate_storageAccountSetBlobInventoryPolicyIncludeDeleteAndNewSchemaForHnsAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobInventoryPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "res7687", "sto9699", armstorage.BlobInventoryPolicyNameDefault, armstorage.BlobInventoryPolicy{ - Properties: &armstorage.BlobInventoryPolicyProperties{ - Policy: &armstorage.BlobInventoryPolicySchema{ - Type: to.Ptr(armstorage.InventoryRuleTypeInventory), - Enabled: to.Ptr(true), - Rules: []*armstorage.BlobInventoryPolicyRule{ - { - Name: to.Ptr("inventoryPolicyRule1"), - Definition: &armstorage.BlobInventoryPolicyDefinition{ - Format: to.Ptr(armstorage.FormatCSV), - Filters: &armstorage.BlobInventoryPolicyFilter{ - BlobTypes: []*string{ - to.Ptr("blockBlob"), - to.Ptr("appendBlob"), - to.Ptr("pageBlob")}, - ExcludePrefix: []*string{ - to.Ptr("excludeprefix1"), - to.Ptr("excludeprefix2")}, - IncludeBlobVersions: to.Ptr(true), - IncludeDeleted: 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("ContentType"), - to.Ptr("ContentEncoding"), - to.Ptr("ContentLanguage"), - to.Ptr("ContentCRC64"), - to.Ptr("CacheControl"), - to.Ptr("Metadata"), - to.Ptr("DeletionId"), - to.Ptr("Deleted"), - to.Ptr("DeletedTime"), - to.Ptr("RemainingRetentionDays")}, - }, - 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("Last-Modified"), - to.Ptr("Metadata"), - to.Ptr("LeaseStatus"), - to.Ptr("LeaseState"), - to.Ptr("LeaseDuration"), - to.Ptr("PublicAccess"), - to.Ptr("HasImmutabilityPolicy"), - to.Ptr("HasLegalHold"), - to.Ptr("Etag"), - to.Ptr("DefaultEncryptionScope"), - to.Ptr("DenyEncryptionScopeOverride"), - to.Ptr("ImmutableStorageWithVersioningEnabled"), - to.Ptr("Deleted"), - to.Ptr("Version"), - to.Ptr("DeletedTime"), - to.Ptr("RemainingRetentionDays")}, - }, - Destination: to.Ptr("container2"), - Enabled: to.Ptr(true), - }}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountSetBlobInventoryPolicyIncludeDeleteAndNewSchemaForNonHnsAccount.json -func ExampleBlobInventoryPoliciesClient_CreateOrUpdate_storageAccountSetBlobInventoryPolicyIncludeDeleteAndNewSchemaForNonHnsAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobInventoryPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "res7687", "sto9699", armstorage.BlobInventoryPolicyNameDefault, armstorage.BlobInventoryPolicy{ - Properties: &armstorage.BlobInventoryPolicyProperties{ - Policy: &armstorage.BlobInventoryPolicySchema{ - Type: to.Ptr(armstorage.InventoryRuleTypeInventory), - Enabled: to.Ptr(true), - Rules: []*armstorage.BlobInventoryPolicyRule{ - { - Name: to.Ptr("inventoryPolicyRule1"), - Definition: &armstorage.BlobInventoryPolicyDefinition{ - Format: to.Ptr(armstorage.FormatCSV), - Filters: &armstorage.BlobInventoryPolicyFilter{ - BlobTypes: []*string{ - to.Ptr("blockBlob"), - to.Ptr("appendBlob"), - to.Ptr("pageBlob")}, - ExcludePrefix: []*string{ - to.Ptr("excludeprefix1"), - to.Ptr("excludeprefix2")}, - IncludeBlobVersions: to.Ptr(true), - IncludeDeleted: 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("Tags"), - to.Ptr("ContentType"), - to.Ptr("ContentEncoding"), - to.Ptr("ContentLanguage"), - to.Ptr("ContentCRC64"), - to.Ptr("CacheControl"), - to.Ptr("Metadata"), - to.Ptr("Deleted"), - to.Ptr("RemainingRetentionDays")}, - }, - 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("Last-Modified"), - to.Ptr("Metadata"), - to.Ptr("LeaseStatus"), - to.Ptr("LeaseState"), - to.Ptr("LeaseDuration"), - to.Ptr("PublicAccess"), - to.Ptr("HasImmutabilityPolicy"), - to.Ptr("HasLegalHold"), - to.Ptr("Etag"), - to.Ptr("DefaultEncryptionScope"), - to.Ptr("DenyEncryptionScopeOverride"), - to.Ptr("ImmutableStorageWithVersioningEnabled"), - to.Ptr("Deleted"), - to.Ptr("Version"), - to.Ptr("DeletedTime"), - to.Ptr("RemainingRetentionDays")}, - }, - Destination: to.Ptr("container2"), - Enabled: to.Ptr(true), - }}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountDeleteBlobInventoryPolicy.json -func ExampleBlobInventoryPoliciesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobInventoryPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "res6977", "sto2527", armstorage.BlobInventoryPolicyNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountListBlobInventoryPolicy.json -func ExampleBlobInventoryPoliciesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobInventoryPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("res7687", "sto9699", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/storage/armstorage/blobservices_client.go b/sdk/resourcemanager/storage/armstorage/blobservices_client.go index 204a6335f663..30d5b5bc6cb5 100644 --- a/sdk/resourcemanager/storage/armstorage/blobservices_client.go +++ b/sdk/resourcemanager/storage/armstorage/blobservices_client.go @@ -58,7 +58,7 @@ func NewBlobServicesClient(subscriptionID string, credential azcore.TokenCredent // GetServiceProperties - Gets the properties of a storage account’s Blob service, including properties for Storage Analytics // and CORS (Cross-Origin Resource Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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 *BlobServicesClient) getServicePropertiesCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -116,8 +116,7 @@ func (client *BlobServicesClient) getServicePropertiesHandleResponse(resp *http. } // NewListPager - List blob services of storage account. It returns a collection of one object named default. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -164,7 +163,7 @@ func (client *BlobServicesClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +181,7 @@ func (client *BlobServicesClient) listHandleResponse(resp *http.Response) (BlobS // SetServiceProperties - Sets the properties of a storage account’s Blob service, including properties for Storage Analytics // and CORS (Cross-Origin Resource Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -226,7 +225,7 @@ func (client *BlobServicesClient) setServicePropertiesCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/storage/armstorage/blobservices_client_example_test.go b/sdk/resourcemanager/storage/armstorage/blobservices_client_example_test.go deleted file mode 100644 index 1e33f51e236a..000000000000 --- a/sdk/resourcemanager/storage/armstorage/blobservices_client_example_test.go +++ /dev/null @@ -1,198 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobServicesList.json -func ExampleBlobServicesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("res4410", "sto8607", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobServicesPutAllowPermanentDelete.json -func ExampleBlobServicesClient_SetServiceProperties_blobServicesPutAllowPermanentDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.SetServiceProperties(ctx, "res4410", "sto8607", armstorage.BlobServiceProperties{ - BlobServiceProperties: &armstorage.BlobServicePropertiesProperties{ - DeleteRetentionPolicy: &armstorage.DeleteRetentionPolicy{ - AllowPermanentDelete: to.Ptr(true), - Days: to.Ptr[int32](300), - Enabled: to.Ptr(true), - }, - IsVersioningEnabled: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobServicesPutLastAccessTimeBasedTracking.json -func ExampleBlobServicesClient_SetServiceProperties_blobServicesPutLastAccessTimeBasedTracking() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.SetServiceProperties(ctx, "res4410", "sto8607", armstorage.BlobServiceProperties{ - BlobServiceProperties: &armstorage.BlobServicePropertiesProperties{ - LastAccessTimeTrackingPolicy: &armstorage.LastAccessTimeTrackingPolicy{ - Name: to.Ptr(armstorage.NameAccessTimeTracking), - BlobType: []*string{ - to.Ptr("blockBlob")}, - Enable: to.Ptr(true), - TrackingGranularityInDays: to.Ptr[int32](1), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobServicesPut.json -func ExampleBlobServicesClient_SetServiceProperties_blobServicesPut() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.SetServiceProperties(ctx, "res4410", "sto8607", armstorage.BlobServiceProperties{ - BlobServiceProperties: &armstorage.BlobServicePropertiesProperties{ - ChangeFeed: &armstorage.ChangeFeed{ - Enabled: to.Ptr(true), - RetentionInDays: to.Ptr[int32](7), - }, - Cors: &armstorage.CorsRules{ - CorsRules: []*armstorage.CorsRule{ - { - AllowedHeaders: []*string{ - to.Ptr("x-ms-meta-abc"), - to.Ptr("x-ms-meta-data*"), - to.Ptr("x-ms-meta-target*")}, - AllowedMethods: []*armstorage.CorsRuleAllowedMethodsItem{ - to.Ptr(armstorage.CorsRuleAllowedMethodsItemGET), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemHEAD), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemPOST), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemOPTIONS), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemMERGE), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemPUT)}, - AllowedOrigins: []*string{ - to.Ptr("http://www.contoso.com"), - to.Ptr("http://www.fabrikam.com")}, - ExposedHeaders: []*string{ - to.Ptr("x-ms-meta-*")}, - MaxAgeInSeconds: to.Ptr[int32](100), - }, - { - AllowedHeaders: []*string{ - to.Ptr("*")}, - AllowedMethods: []*armstorage.CorsRuleAllowedMethodsItem{ - to.Ptr(armstorage.CorsRuleAllowedMethodsItemGET)}, - AllowedOrigins: []*string{ - to.Ptr("*")}, - ExposedHeaders: []*string{ - to.Ptr("*")}, - MaxAgeInSeconds: to.Ptr[int32](2), - }, - { - AllowedHeaders: []*string{ - to.Ptr("x-ms-meta-12345675754564*")}, - AllowedMethods: []*armstorage.CorsRuleAllowedMethodsItem{ - to.Ptr(armstorage.CorsRuleAllowedMethodsItemGET), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemPUT)}, - AllowedOrigins: []*string{ - to.Ptr("http://www.abc23.com"), - to.Ptr("https://www.fabrikam.com/*")}, - ExposedHeaders: []*string{ - to.Ptr("x-ms-meta-abc"), - to.Ptr("x-ms-meta-data*"), - to.Ptr("x -ms-meta-target*")}, - MaxAgeInSeconds: to.Ptr[int32](2000), - }}, - }, - DefaultServiceVersion: to.Ptr("2017-07-29"), - DeleteRetentionPolicy: &armstorage.DeleteRetentionPolicy{ - Days: to.Ptr[int32](300), - Enabled: to.Ptr(true), - }, - IsVersioningEnabled: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/BlobServicesGet.json -func ExampleBlobServicesClient_GetServiceProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewBlobServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetServiceProperties(ctx, "res4410", "sto8607", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/storage/armstorage/constants.go b/sdk/resourcemanager/storage/armstorage/constants.go index 689b816614ca..f220fa04def4 100644 --- a/sdk/resourcemanager/storage/armstorage/constants.go +++ b/sdk/resourcemanager/storage/armstorage/constants.go @@ -11,7 +11,7 @@ package armstorage const ( moduleName = "armstorage" - moduleVersion = "v1.1.0" + moduleVersion = "v2.0.0" ) // AccessTier - Required for storage accounts where kind = BlobStorage. The access tier is used for billing. The 'Premium' @@ -677,6 +677,23 @@ func PossibleListContainersIncludeValues() []ListContainersInclude { } } +type ListEncryptionScopesInclude string + +const ( + ListEncryptionScopesIncludeAll ListEncryptionScopesInclude = "All" + ListEncryptionScopesIncludeDisabled ListEncryptionScopesInclude = "Disabled" + ListEncryptionScopesIncludeEnabled ListEncryptionScopesInclude = "Enabled" +) + +// PossibleListEncryptionScopesIncludeValues returns the possible values for the ListEncryptionScopesInclude const type. +func PossibleListEncryptionScopesIncludeValues() []ListEncryptionScopesInclude { + return []ListEncryptionScopesInclude{ + ListEncryptionScopesIncludeAll, + ListEncryptionScopesIncludeDisabled, + ListEncryptionScopesIncludeEnabled, + } +} + type ManagementPolicyName string const ( diff --git a/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go b/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go index 7d27acf7fcc2..18c02934f8f2 100644 --- a/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go +++ b/sdk/resourcemanager/storage/armstorage/deletedaccounts_client.go @@ -57,7 +57,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-05-01 +// Generated from API version 2022-09-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. @@ -96,7 +96,7 @@ func (client *DeletedAccountsClient) getCreateRequest(ctx context.Context, delet return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -112,8 +112,7 @@ func (client *DeletedAccountsClient) getHandleResponse(resp *http.Response) (Del } // NewListPager - Lists deleted accounts under the subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-01 // options - DeletedAccountsClientListOptions contains the optional parameters for the DeletedAccountsClient.List method. func (client *DeletedAccountsClient) NewListPager(options *DeletedAccountsClientListOptions) *runtime.Pager[DeletedAccountsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[DeletedAccountsClientListResponse]{ @@ -155,7 +154,7 @@ func (client *DeletedAccountsClient) listCreateRequest(ctx context.Context, opti return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-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 deleted file mode 100644 index ec2febc3147b..000000000000 --- a/sdk/resourcemanager/storage/armstorage/deletedaccounts_client_example_test.go +++ /dev/null @@ -1,60 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/DeletedAccountList.json -func ExampleDeletedAccountsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewDeletedAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/DeletedAccountGet.json -func ExampleDeletedAccountsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewDeletedAccountsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "sto1125", "eastus", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go b/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go index a2092bcb18f2..a55252288632 100644 --- a/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go +++ b/sdk/resourcemanager/storage/armstorage/encryptionscopes_client.go @@ -20,6 +20,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) @@ -57,7 +58,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-05-01 +// Generated from API version 2022-09-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. @@ -104,7 +105,7 @@ func (client *EncryptionScopesClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -120,8 +121,7 @@ func (client *EncryptionScopesClient) getHandleResponse(resp *http.Response) (En } // NewListPager - Lists all the encryption scopes available under the specified storage account. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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,16 @@ func (client *EncryptionScopesClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") + if options != nil && options.Maxpagesize != nil { + reqQP.Set("$maxpagesize", strconv.FormatInt(int64(*options.Maxpagesize), 10)) + } + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Include != nil { + reqQP.Set("$include", string(*options.Include)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,7 +201,7 @@ func (client *EncryptionScopesClient) listHandleResponse(resp *http.Response) (E // Patch - Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope // does not already exist. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -240,7 +249,7 @@ func (client *EncryptionScopesClient) patchCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, encryptionScope) @@ -259,7 +268,7 @@ func (client *EncryptionScopesClient) patchHandleResponse(resp *http.Response) ( // is already created and a subsequent request is issued with different properties, the // 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-05-01 +// Generated from API version 2022-09-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. @@ -307,7 +316,7 @@ func (client *EncryptionScopesClient) putCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, encryptionScope) diff --git a/sdk/resourcemanager/storage/armstorage/encryptionscopes_client_example_test.go b/sdk/resourcemanager/storage/armstorage/encryptionscopes_client_example_test.go deleted file mode 100644 index 190f61889e93..000000000000 --- a/sdk/resourcemanager/storage/armstorage/encryptionscopes_client_example_test.go +++ /dev/null @@ -1,129 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountPutEncryptionScope.json -func ExampleEncryptionScopesClient_Put_storageAccountPutEncryptionScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewEncryptionScopesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Put(ctx, "resource-group-name", "{storage-account-name}", "{encryption-scope-name}", armstorage.EncryptionScope{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountPutEncryptionScopeWithInfrastructureEncryption.json -func ExampleEncryptionScopesClient_Put_storageAccountPutEncryptionScopeWithInfrastructureEncryption() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewEncryptionScopesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Put(ctx, "resource-group-name", "{storage-account-name}", "{encryption-scope-name}", armstorage.EncryptionScope{ - EncryptionScopeProperties: &armstorage.EncryptionScopeProperties{ - RequireInfrastructureEncryption: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountPatchEncryptionScope.json -func ExampleEncryptionScopesClient_Patch() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewEncryptionScopesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Patch(ctx, "resource-group-name", "{storage-account-name}", "{encryption-scope-name}", armstorage.EncryptionScope{ - EncryptionScopeProperties: &armstorage.EncryptionScopeProperties{ - KeyVaultProperties: &armstorage.EncryptionScopeKeyVaultProperties{ - KeyURI: to.Ptr("https://testvault.vault.core.windows.net/keys/key1/863425f1358359c"), - }, - Source: to.Ptr(armstorage.EncryptionScopeSourceMicrosoftKeyVault), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountGetEncryptionScope.json -func ExampleEncryptionScopesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewEncryptionScopesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "resource-group-name", "{storage-account-name}", "{encryption-scope-name}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountEncryptionScopeList.json -func ExampleEncryptionScopesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewEncryptionScopesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("resource-group-name", "{storage-account-name}", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/storage/armstorage/fileservices_client.go b/sdk/resourcemanager/storage/armstorage/fileservices_client.go index 2db2defaac11..bbe8e272ee5e 100644 --- a/sdk/resourcemanager/storage/armstorage/fileservices_client.go +++ b/sdk/resourcemanager/storage/armstorage/fileservices_client.go @@ -58,7 +58,7 @@ func NewFileServicesClient(subscriptionID string, credential azcore.TokenCredent // GetServiceProperties - Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource // Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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 *FileServicesClient) getServicePropertiesCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,7 +117,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-05-01 +// Generated from API version 2022-09-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. @@ -157,7 +157,7 @@ func (client *FileServicesClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -175,7 +175,7 @@ func (client *FileServicesClient) listHandleResponse(resp *http.Response) (FileS // SetServiceProperties - Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource // Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -218,7 +218,7 @@ func (client *FileServicesClient) setServicePropertiesCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/storage/armstorage/fileservices_client_example_test.go b/sdk/resourcemanager/storage/armstorage/fileservices_client_example_test.go deleted file mode 100644 index 92e4781f8e25..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fileservices_client_example_test.go +++ /dev/null @@ -1,185 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileServicesList.json -func ExampleFileServicesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, "res9290", "sto1590", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileServicesPut.json -func ExampleFileServicesClient_SetServiceProperties_fileServicesPut() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.SetServiceProperties(ctx, "res4410", "sto8607", armstorage.FileServiceProperties{ - FileServiceProperties: &armstorage.FileServicePropertiesProperties{ - Cors: &armstorage.CorsRules{ - CorsRules: []*armstorage.CorsRule{ - { - AllowedHeaders: []*string{ - to.Ptr("x-ms-meta-abc"), - to.Ptr("x-ms-meta-data*"), - to.Ptr("x-ms-meta-target*")}, - AllowedMethods: []*armstorage.CorsRuleAllowedMethodsItem{ - to.Ptr(armstorage.CorsRuleAllowedMethodsItemGET), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemHEAD), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemPOST), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemOPTIONS), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemMERGE), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemPUT)}, - AllowedOrigins: []*string{ - to.Ptr("http://www.contoso.com"), - to.Ptr("http://www.fabrikam.com")}, - ExposedHeaders: []*string{ - to.Ptr("x-ms-meta-*")}, - MaxAgeInSeconds: to.Ptr[int32](100), - }, - { - AllowedHeaders: []*string{ - to.Ptr("*")}, - AllowedMethods: []*armstorage.CorsRuleAllowedMethodsItem{ - to.Ptr(armstorage.CorsRuleAllowedMethodsItemGET)}, - AllowedOrigins: []*string{ - to.Ptr("*")}, - ExposedHeaders: []*string{ - to.Ptr("*")}, - MaxAgeInSeconds: to.Ptr[int32](2), - }, - { - AllowedHeaders: []*string{ - to.Ptr("x-ms-meta-12345675754564*")}, - AllowedMethods: []*armstorage.CorsRuleAllowedMethodsItem{ - to.Ptr(armstorage.CorsRuleAllowedMethodsItemGET), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemPUT)}, - AllowedOrigins: []*string{ - to.Ptr("http://www.abc23.com"), - to.Ptr("https://www.fabrikam.com/*")}, - ExposedHeaders: []*string{ - to.Ptr("x-ms-meta-abc"), - to.Ptr("x-ms-meta-data*"), - to.Ptr("x-ms-meta-target*")}, - MaxAgeInSeconds: to.Ptr[int32](2000), - }}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileServicesPut_EnableSMBMultichannel.json -func ExampleFileServicesClient_SetServiceProperties_fileServicesPut_EnableSMBMultichannel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.SetServiceProperties(ctx, "res4410", "sto8607", armstorage.FileServiceProperties{ - FileServiceProperties: &armstorage.FileServicePropertiesProperties{ - ProtocolSettings: &armstorage.ProtocolSettings{ - Smb: &armstorage.SmbSetting{ - Multichannel: &armstorage.Multichannel{ - Enabled: to.Ptr(true), - }, - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileServicesPut_EnableSecureSmbFeatures.json -func ExampleFileServicesClient_SetServiceProperties_fileServicesPut_EnableSecureSmbFeatures() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.SetServiceProperties(ctx, "res4410", "sto8607", armstorage.FileServiceProperties{ - FileServiceProperties: &armstorage.FileServicePropertiesProperties{ - ProtocolSettings: &armstorage.ProtocolSettings{ - Smb: &armstorage.SmbSetting{ - AuthenticationMethods: to.Ptr("NTLMv2;Kerberos"), - ChannelEncryption: to.Ptr("AES-128-CCM;AES-128-GCM;AES-256-GCM"), - KerberosTicketEncryption: to.Ptr("RC4-HMAC;AES-256"), - Versions: to.Ptr("SMB2.1;SMB3.0;SMB3.1.1"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileServicesGet.json -func ExampleFileServicesClient_GetServiceProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetServiceProperties(ctx, "res4410", "sto8607", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/storage/armstorage/fileshares_client.go b/sdk/resourcemanager/storage/armstorage/fileshares_client.go index 47d5da5e25a9..22110d7ccb5c 100644 --- a/sdk/resourcemanager/storage/armstorage/fileshares_client.go +++ b/sdk/resourcemanager/storage/armstorage/fileshares_client.go @@ -59,7 +59,7 @@ func NewFileSharesClient(subscriptionID string, credential azcore.TokenCredentia // and properties for that share. It does not include a list of the files contained by // the share. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -110,7 +110,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-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, fileShare) @@ -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-05-01 +// Generated from API version 2022-09-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 *FileSharesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") if options != nil && options.Include != nil { reqQP.Set("$include", *options.Include) } @@ -188,7 +188,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-05-01 +// Generated from API version 2022-09-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 *FileSharesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -259,7 +259,7 @@ func (client *FileSharesClient) getHandleResponse(resp *http.Response) (FileShar // Lease - The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration 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-05-01 +// Generated from API version 2022-09-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. @@ -306,7 +306,7 @@ func (client *FileSharesClient) leaseCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.XMSSnapshot != nil { req.Raw().Header["x-ms-snapshot"] = []string{*options.XMSSnapshot} @@ -331,8 +331,7 @@ func (client *FileSharesClient) leaseHandleResponse(resp *http.Response) (FileSh } // NewListPager - Lists all shares. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -385,7 +384,7 @@ func (client *FileSharesClient) listCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") if options != nil && options.Maxpagesize != nil { reqQP.Set("$maxpagesize", *options.Maxpagesize) } @@ -411,7 +410,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-05-01 +// Generated from API version 2022-09-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. @@ -458,7 +457,7 @@ func (client *FileSharesClient) restoreCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, deletedShare) @@ -467,7 +466,7 @@ func (client *FileSharesClient) restoreCreateRequest(ctx context.Context, resour // Update - Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. // 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-05-01 +// Generated from API version 2022-09-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. @@ -515,7 +514,7 @@ func (client *FileSharesClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, fileShare) diff --git a/sdk/resourcemanager/storage/armstorage/fileshares_client_example_test.go b/sdk/resourcemanager/storage/armstorage/fileshares_client_example_test.go deleted file mode 100644 index 28f210a281ca..000000000000 --- a/sdk/resourcemanager/storage/armstorage/fileshares_client_example_test.go +++ /dev/null @@ -1,351 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/DeletedFileSharesList.json -func ExampleFileSharesClient_NewListPager_deletedFileSharesList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileSharesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("res9290", "sto1590", &armstorage.FileSharesClientListOptions{Maxpagesize: nil, - Filter: nil, - Expand: to.Ptr("deleted"), - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileShareSnapshotsList.json -func ExampleFileSharesClient_NewListPager_fileShareSnapshotsList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileSharesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("res9290", "sto1590", &armstorage.FileSharesClientListOptions{Maxpagesize: nil, - Filter: nil, - Expand: to.Ptr("snapshots"), - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileSharesList.json -func ExampleFileSharesClient_NewListPager_fileSharesList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileSharesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("res9290", "sto1590", &armstorage.FileSharesClientListOptions{Maxpagesize: nil, - Filter: nil, - Expand: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileSharesPut_NFS.json -func ExampleFileSharesClient_Create_fileSharesPut_NFS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileSharesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, "res346", "sto666", "share1235", armstorage.FileShare{ - FileShareProperties: &armstorage.FileShareProperties{ - EnabledProtocols: to.Ptr(armstorage.EnabledProtocolsNFS), - }, - }, &armstorage.FileSharesClientCreateOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileSharesPut.json -func ExampleFileSharesClient_Create_fileSharesPut() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileSharesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, "res3376", "sto328", "share6185", armstorage.FileShare{}, &armstorage.FileSharesClientCreateOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileSharesPut_AccessTier.json -func ExampleFileSharesClient_Create_fileSharesPut_AccessTier() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileSharesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, "res346", "sto666", "share1235", armstorage.FileShare{ - FileShareProperties: &armstorage.FileShareProperties{ - AccessTier: to.Ptr(armstorage.ShareAccessTierHot), - }, - }, &armstorage.FileSharesClientCreateOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileShareAclsPatch.json -func ExampleFileSharesClient_Update_fileShareAclsPatch() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileSharesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "res3376", "sto328", "share6185", armstorage.FileShare{ - FileShareProperties: &armstorage.FileShareProperties{ - SignedIdentifiers: []*armstorage.SignedIdentifier{ - { - AccessPolicy: &armstorage.AccessPolicy{ - ExpiryTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-01T08:49:37.0000000Z"); return t }()), - Permission: to.Ptr("rwd"), - StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T08:49:37.0000000Z"); return t }()), - }, - ID: to.Ptr("MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI"), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileSharesPatch.json -func ExampleFileSharesClient_Update_fileSharesPatch() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileSharesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "res3376", "sto328", "share6185", armstorage.FileShare{ - FileShareProperties: &armstorage.FileShareProperties{ - Metadata: map[string]*string{ - "type": to.Ptr("image"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileSharesGet_Stats.json -func ExampleFileSharesClient_Get_fileSharesGet_Stats() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileSharesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "res9871", "sto6217", "share1634", &armstorage.FileSharesClientGetOptions{Expand: to.Ptr("stats"), - XMSSnapshot: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileSharesGet.json -func ExampleFileSharesClient_Get_fileSharesGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileSharesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "res9871", "sto6217", "share1634", &armstorage.FileSharesClientGetOptions{Expand: nil, - XMSSnapshot: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileSharesDelete.json -func ExampleFileSharesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileSharesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "res4079", "sto4506", "share9689", &armstorage.FileSharesClientDeleteOptions{XMSSnapshot: nil, - Include: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileSharesRestore.json -func ExampleFileSharesClient_Restore() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileSharesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Restore(ctx, "res3376", "sto328", "share1249", armstorage.DeletedShare{ - DeletedShareName: to.Ptr("share1249"), - DeletedShareVersion: to.Ptr("1234567890"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileSharesLease_Acquire.json -func ExampleFileSharesClient_Lease_fileSharesLease_Acquire() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileSharesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Lease(ctx, "res3376", "sto328", "share124", &armstorage.FileSharesClientLeaseOptions{XMSSnapshot: nil, - Parameters: &armstorage.LeaseShareRequest{ - Action: to.Ptr(armstorage.LeaseShareActionAcquire), - LeaseDuration: to.Ptr[int32](-1), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/FileSharesLease_Break.json -func ExampleFileSharesClient_Lease_fileSharesLease_Break() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewFileSharesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Lease(ctx, "res3376", "sto328", "share12", &armstorage.FileSharesClientLeaseOptions{XMSSnapshot: nil, - Parameters: &armstorage.LeaseShareRequest{ - Action: to.Ptr(armstorage.LeaseShareActionBreak), - LeaseID: to.Ptr("8698f513-fa75-44a1-b8eb-30ba336af27d"), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/storage/armstorage/go.mod b/sdk/resourcemanager/storage/armstorage/go.mod index b914d53269fe..c590630fde54 100644 --- a/sdk/resourcemanager/storage/armstorage/go.mod +++ b/sdk/resourcemanager/storage/armstorage/go.mod @@ -1,15 +1,15 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage/v2 go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.0.0 github.com/stretchr/testify v1.7.0 ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect diff --git a/sdk/resourcemanager/storage/armstorage/localusers_client.go b/sdk/resourcemanager/storage/armstorage/localusers_client.go index f95a32cb76fe..6cabe4f92668 100644 --- a/sdk/resourcemanager/storage/armstorage/localusers_client.go +++ b/sdk/resourcemanager/storage/armstorage/localusers_client.go @@ -57,7 +57,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-05-01 +// Generated from API version 2022-09-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. @@ -105,7 +105,7 @@ func (client *LocalUsersClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, properties) @@ -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-05-01 +// Generated from API version 2022-09-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. @@ -168,7 +168,7 @@ func (client *LocalUsersClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -176,7 +176,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-05-01 +// Generated from API version 2022-09-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. @@ -222,7 +222,7 @@ func (client *LocalUsersClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -238,8 +238,7 @@ func (client *LocalUsersClient) getHandleResponse(resp *http.Response) (LocalUse } // NewListPager - List the local users associated with the storage account. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -286,7 +285,7 @@ func (client *LocalUsersClient) listCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -303,7 +302,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-05-01 +// Generated from API version 2022-09-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. @@ -349,7 +348,7 @@ func (client *LocalUsersClient) listKeysCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -366,7 +365,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-05-01 +// Generated from API version 2022-09-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. @@ -413,7 +412,7 @@ func (client *LocalUsersClient) regeneratePasswordCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-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 deleted file mode 100644 index 8ed97d037e5f..000000000000 --- a/sdk/resourcemanager/storage/armstorage/localusers_client_example_test.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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/LocalUsersList.json -func ExampleLocalUsersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewLocalUsersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("res6977", "sto2527", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/LocalUserGet.json -func ExampleLocalUsersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewLocalUsersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "res6977", "sto2527", "user1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/LocalUserCreate.json -func ExampleLocalUsersClient_CreateOrUpdate_localUserCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewLocalUsersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "res6977", "sto2527", "user1", armstorage.LocalUser{ - Properties: &armstorage.LocalUserProperties{ - HasSSHPassword: to.Ptr(true), - HomeDirectory: to.Ptr("homedirectory"), - PermissionScopes: []*armstorage.PermissionScope{ - { - Permissions: to.Ptr("rwd"), - ResourceName: to.Ptr("share1"), - Service: to.Ptr("file"), - }, - { - Permissions: to.Ptr("rw"), - ResourceName: to.Ptr("share2"), - Service: to.Ptr("file"), - }}, - SSHAuthorizedKeys: []*armstorage.SSHPublicKey{ - { - Description: to.Ptr("key name"), - Key: to.Ptr("ssh-rsa keykeykeykeykey="), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/LocalUserUpdate.json -func ExampleLocalUsersClient_CreateOrUpdate_localUserUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewLocalUsersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "res6977", "sto2527", "user1", armstorage.LocalUser{ - Properties: &armstorage.LocalUserProperties{ - HasSharedKey: to.Ptr(false), - HasSSHKey: to.Ptr(false), - HasSSHPassword: to.Ptr(false), - HomeDirectory: to.Ptr("homedirectory2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/LocalUserDelete.json -func ExampleLocalUsersClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewLocalUsersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "res6977", "sto2527", "user1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/LocalUserListKeys.json -func ExampleLocalUsersClient_ListKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewLocalUsersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListKeys(ctx, "res6977", "sto2527", "user1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/LocalUserRegeneratePassword.json -func ExampleLocalUsersClient_RegeneratePassword() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewLocalUsersClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.RegeneratePassword(ctx, "res6977", "sto2527", "user1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go b/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go index 437aa0b2cd03..c3e937282cfa 100644 --- a/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go +++ b/sdk/resourcemanager/storage/armstorage/managementpolicies_client.go @@ -57,7 +57,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-05-01 +// Generated from API version 2022-09-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. @@ -104,7 +104,7 @@ func (client *ManagementPoliciesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, properties) @@ -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-05-01 +// Generated from API version 2022-09-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. @@ -167,14 +167,14 @@ func (client *ManagementPoliciesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // 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-05-01 +// Generated from API version 2022-09-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. @@ -219,7 +219,7 @@ func (client *ManagementPoliciesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-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 deleted file mode 100644 index 636e33066889..000000000000 --- a/sdk/resourcemanager/storage/armstorage/managementpolicies_client_example_test.go +++ /dev/null @@ -1,448 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountGetManagementPolicy.json -func ExampleManagementPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewManagementPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "res6977", "sto2527", armstorage.ManagementPolicyNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountSetManagementPolicy.json -func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementPolicy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewManagementPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "res7687", "sto9699", armstorage.ManagementPolicyNameDefault, armstorage.ManagementPolicy{ - Properties: &armstorage.ManagementPolicyProperties{ - Policy: &armstorage.ManagementPolicySchema{ - Rules: []*armstorage.ManagementPolicyRule{ - { - Name: to.Ptr("olcmtest1"), - Type: to.Ptr(armstorage.RuleTypeLifecycle), - Definition: &armstorage.ManagementPolicyDefinition{ - Actions: &armstorage.ManagementPolicyAction{ - BaseBlob: &armstorage.ManagementPolicyBaseBlob{ - Delete: &armstorage.DateAfterModification{ - DaysAfterModificationGreaterThan: to.Ptr[float32](1000), - }, - TierToArchive: &armstorage.DateAfterModification{ - DaysAfterModificationGreaterThan: to.Ptr[float32](90), - }, - TierToCool: &armstorage.DateAfterModification{ - DaysAfterModificationGreaterThan: to.Ptr[float32](30), - }, - }, - Snapshot: &armstorage.ManagementPolicySnapShot{ - Delete: &armstorage.DateAfterCreation{ - DaysAfterCreationGreaterThan: to.Ptr[float32](30), - }, - }, - }, - Filters: &armstorage.ManagementPolicyFilter{ - BlobTypes: []*string{ - to.Ptr("blockBlob")}, - PrefixMatch: []*string{ - to.Ptr("olcmtestcontainer1")}, - }, - }, - Enabled: to.Ptr(true), - }, - { - Name: to.Ptr("olcmtest2"), - Type: to.Ptr(armstorage.RuleTypeLifecycle), - Definition: &armstorage.ManagementPolicyDefinition{ - Actions: &armstorage.ManagementPolicyAction{ - BaseBlob: &armstorage.ManagementPolicyBaseBlob{ - Delete: &armstorage.DateAfterModification{ - DaysAfterModificationGreaterThan: to.Ptr[float32](1000), - }, - TierToArchive: &armstorage.DateAfterModification{ - DaysAfterModificationGreaterThan: to.Ptr[float32](90), - }, - TierToCool: &armstorage.DateAfterModification{ - DaysAfterModificationGreaterThan: to.Ptr[float32](30), - }, - }, - }, - Filters: &armstorage.ManagementPolicyFilter{ - BlobIndexMatch: []*armstorage.TagFilter{ - { - Name: to.Ptr("tag1"), - Op: to.Ptr("=="), - Value: to.Ptr("val1"), - }, - { - Name: to.Ptr("tag2"), - Op: to.Ptr("=="), - Value: to.Ptr("val2"), - }}, - BlobTypes: []*string{ - to.Ptr("blockBlob")}, - PrefixMatch: []*string{ - to.Ptr("olcmtestcontainer2")}, - }, - }, - Enabled: to.Ptr(true), - }}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountSetManagementPolicyForBlockAndAppendBlobs.json -func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementPolicyForBlockAndAppendBlobs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewManagementPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "res7687", "sto9699", armstorage.ManagementPolicyNameDefault, armstorage.ManagementPolicy{ - Properties: &armstorage.ManagementPolicyProperties{ - Policy: &armstorage.ManagementPolicySchema{ - Rules: []*armstorage.ManagementPolicyRule{ - { - Name: to.Ptr("olcmtest1"), - Type: to.Ptr(armstorage.RuleTypeLifecycle), - Definition: &armstorage.ManagementPolicyDefinition{ - Actions: &armstorage.ManagementPolicyAction{ - BaseBlob: &armstorage.ManagementPolicyBaseBlob{ - Delete: &armstorage.DateAfterModification{ - DaysAfterModificationGreaterThan: to.Ptr[float32](90), - }, - }, - Snapshot: &armstorage.ManagementPolicySnapShot{ - Delete: &armstorage.DateAfterCreation{ - DaysAfterCreationGreaterThan: to.Ptr[float32](90), - }, - }, - Version: &armstorage.ManagementPolicyVersion{ - Delete: &armstorage.DateAfterCreation{ - DaysAfterCreationGreaterThan: to.Ptr[float32](90), - }, - }, - }, - Filters: &armstorage.ManagementPolicyFilter{ - BlobTypes: []*string{ - to.Ptr("blockBlob"), - to.Ptr("appendBlob")}, - PrefixMatch: []*string{ - to.Ptr("olcmtestcontainer1")}, - }, - }, - Enabled: to.Ptr(true), - }}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountSetManagementPolicyWithSnapshotAndVersion.json -func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementPolicyWithSnapshotAndVersion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewManagementPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "res7687", "sto9699", armstorage.ManagementPolicyNameDefault, armstorage.ManagementPolicy{ - Properties: &armstorage.ManagementPolicyProperties{ - Policy: &armstorage.ManagementPolicySchema{ - Rules: []*armstorage.ManagementPolicyRule{ - { - Name: to.Ptr("olcmtest1"), - Type: to.Ptr(armstorage.RuleTypeLifecycle), - Definition: &armstorage.ManagementPolicyDefinition{ - Actions: &armstorage.ManagementPolicyAction{ - BaseBlob: &armstorage.ManagementPolicyBaseBlob{ - Delete: &armstorage.DateAfterModification{ - DaysAfterModificationGreaterThan: to.Ptr[float32](1000), - }, - TierToArchive: &armstorage.DateAfterModification{ - DaysAfterModificationGreaterThan: to.Ptr[float32](90), - }, - TierToCool: &armstorage.DateAfterModification{ - DaysAfterModificationGreaterThan: to.Ptr[float32](30), - }, - }, - Snapshot: &armstorage.ManagementPolicySnapShot{ - Delete: &armstorage.DateAfterCreation{ - DaysAfterCreationGreaterThan: to.Ptr[float32](1000), - }, - TierToArchive: &armstorage.DateAfterCreation{ - DaysAfterCreationGreaterThan: to.Ptr[float32](90), - }, - TierToCool: &armstorage.DateAfterCreation{ - DaysAfterCreationGreaterThan: to.Ptr[float32](30), - }, - }, - Version: &armstorage.ManagementPolicyVersion{ - Delete: &armstorage.DateAfterCreation{ - DaysAfterCreationGreaterThan: to.Ptr[float32](1000), - }, - TierToArchive: &armstorage.DateAfterCreation{ - DaysAfterCreationGreaterThan: to.Ptr[float32](90), - }, - TierToCool: &armstorage.DateAfterCreation{ - DaysAfterCreationGreaterThan: to.Ptr[float32](30), - }, - }, - }, - Filters: &armstorage.ManagementPolicyFilter{ - BlobTypes: []*string{ - to.Ptr("blockBlob")}, - PrefixMatch: []*string{ - to.Ptr("olcmtestcontainer1")}, - }, - }, - Enabled: to.Ptr(true), - }}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountSetManagementPolicy_BaseBlobDaysAfterCreationActions.json -func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementPolicy_BaseBlobDaysAfterCreationActions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewManagementPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "res7687", "sto9699", armstorage.ManagementPolicyNameDefault, armstorage.ManagementPolicy{ - Properties: &armstorage.ManagementPolicyProperties{ - Policy: &armstorage.ManagementPolicySchema{ - Rules: []*armstorage.ManagementPolicyRule{ - { - Name: to.Ptr("olcmtest1"), - Type: to.Ptr(armstorage.RuleTypeLifecycle), - Definition: &armstorage.ManagementPolicyDefinition{ - Actions: &armstorage.ManagementPolicyAction{ - BaseBlob: &armstorage.ManagementPolicyBaseBlob{ - Delete: &armstorage.DateAfterModification{ - DaysAfterCreationGreaterThan: to.Ptr[float32](1000), - }, - TierToArchive: &armstorage.DateAfterModification{ - DaysAfterCreationGreaterThan: to.Ptr[float32](90), - }, - TierToCool: &armstorage.DateAfterModification{ - DaysAfterCreationGreaterThan: to.Ptr[float32](30), - }, - }, - }, - Filters: &armstorage.ManagementPolicyFilter{ - BlobTypes: []*string{ - to.Ptr("blockBlob")}, - PrefixMatch: []*string{ - to.Ptr("olcmtestcontainer1")}, - }, - }, - Enabled: to.Ptr(true), - }}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountSetManagementPolicy_LastAccessTimeBasedBlobActions.json -func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementPolicy_LastAccessTimeBasedBlobActions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewManagementPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "res7687", "sto9699", armstorage.ManagementPolicyNameDefault, armstorage.ManagementPolicy{ - Properties: &armstorage.ManagementPolicyProperties{ - Policy: &armstorage.ManagementPolicySchema{ - Rules: []*armstorage.ManagementPolicyRule{ - { - Name: to.Ptr("olcmtest"), - Type: to.Ptr(armstorage.RuleTypeLifecycle), - Definition: &armstorage.ManagementPolicyDefinition{ - Actions: &armstorage.ManagementPolicyAction{ - BaseBlob: &armstorage.ManagementPolicyBaseBlob{ - Delete: &armstorage.DateAfterModification{ - DaysAfterLastAccessTimeGreaterThan: to.Ptr[float32](1000), - }, - EnableAutoTierToHotFromCool: to.Ptr(true), - TierToArchive: &armstorage.DateAfterModification{ - DaysAfterLastAccessTimeGreaterThan: to.Ptr[float32](90), - }, - TierToCool: &armstorage.DateAfterModification{ - DaysAfterLastAccessTimeGreaterThan: to.Ptr[float32](30), - }, - }, - Snapshot: &armstorage.ManagementPolicySnapShot{ - Delete: &armstorage.DateAfterCreation{ - DaysAfterCreationGreaterThan: to.Ptr[float32](30), - }, - }, - }, - Filters: &armstorage.ManagementPolicyFilter{ - BlobTypes: []*string{ - to.Ptr("blockBlob")}, - PrefixMatch: []*string{ - to.Ptr("olcmtestcontainer")}, - }, - }, - Enabled: to.Ptr(true), - }}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountSetManagementPolicy_LastTierChangeTimeActions.json -func ExampleManagementPoliciesClient_CreateOrUpdate_storageAccountSetManagementPolicy_LastTierChangeTimeActions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewManagementPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "res7687", "sto9699", armstorage.ManagementPolicyNameDefault, armstorage.ManagementPolicy{ - Properties: &armstorage.ManagementPolicyProperties{ - Policy: &armstorage.ManagementPolicySchema{ - Rules: []*armstorage.ManagementPolicyRule{ - { - Name: to.Ptr("olcmtest"), - Type: to.Ptr(armstorage.RuleTypeLifecycle), - Definition: &armstorage.ManagementPolicyDefinition{ - Actions: &armstorage.ManagementPolicyAction{ - BaseBlob: &armstorage.ManagementPolicyBaseBlob{ - Delete: &armstorage.DateAfterModification{ - DaysAfterModificationGreaterThan: to.Ptr[float32](1000), - }, - TierToArchive: &armstorage.DateAfterModification{ - DaysAfterLastTierChangeGreaterThan: to.Ptr[float32](120), - DaysAfterModificationGreaterThan: to.Ptr[float32](90), - }, - TierToCool: &armstorage.DateAfterModification{ - DaysAfterModificationGreaterThan: to.Ptr[float32](30), - }, - }, - Snapshot: &armstorage.ManagementPolicySnapShot{ - TierToArchive: &armstorage.DateAfterCreation{ - DaysAfterCreationGreaterThan: to.Ptr[float32](30), - DaysAfterLastTierChangeGreaterThan: to.Ptr[float32](90), - }, - }, - Version: &armstorage.ManagementPolicyVersion{ - TierToArchive: &armstorage.DateAfterCreation{ - DaysAfterCreationGreaterThan: to.Ptr[float32](30), - DaysAfterLastTierChangeGreaterThan: to.Ptr[float32](90), - }, - }, - }, - Filters: &armstorage.ManagementPolicyFilter{ - BlobTypes: []*string{ - to.Ptr("blockBlob")}, - PrefixMatch: []*string{ - to.Ptr("olcmtestcontainer")}, - }, - }, - Enabled: to.Ptr(true), - }}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountDeleteManagementPolicy.json -func ExampleManagementPoliciesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewManagementPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "res6977", "sto2527", armstorage.ManagementPolicyNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/storage/armstorage/models.go b/sdk/resourcemanager/storage/armstorage/models.go index d938f500ad81..218c359a4463 100644 --- a/sdk/resourcemanager/storage/armstorage/models.go +++ b/sdk/resourcemanager/storage/armstorage/models.go @@ -562,6 +562,9 @@ type AccountsClientBeginCreateOptions struct { // 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 + // value to Planned. + FailoverType *string // Resumes the LRO from the provided token. ResumeToken string } @@ -1085,27 +1088,6 @@ type CheckNameAvailabilityResult struct { Reason *Reason `json:"reason,omitempty" azure:"ro"` } -// CloudError - An error response from the Storage service. -type CloudError struct { - // An error response from the Storage service. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody - An error response from the Storage service. -type CloudErrorBody struct { - // An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - - // A list of additional details about the error. - Details []*CloudErrorBody `json:"details,omitempty"` - - // A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - - // The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` -} - // ContainerProperties - The properties of a container. type ContainerProperties struct { // Default the container to use specified encryption scope for all writes. @@ -1424,7 +1406,12 @@ type EncryptionScopesClientGetOptions struct { // EncryptionScopesClientListOptions contains the optional parameters for the EncryptionScopesClient.List method. type EncryptionScopesClientListOptions struct { - // placeholder for future optional parameters + // Optional. When specified, only encryption scope names starting with the filter will be listed. + Filter *string + // Optional, when specified, will list encryption scopes with the specific state. Defaults to All + Include *ListEncryptionScopesInclude + // Optional, specifies the maximum number of encryption scopes that will be included in the list response. + Maxpagesize *int32 } // EncryptionScopesClientPatchOptions contains the optional parameters for the EncryptionScopesClient.Patch method. @@ -2236,11 +2223,17 @@ type ManagementPolicyBaseBlob struct { // This property enables auto tiering of a blob from cool to hot on a blob access. This property requires tierToCool.daysAfterLastAccessTimeGreaterThan. EnableAutoTierToHotFromCool *bool `json:"enableAutoTierToHotFromCool,omitempty"` - // The function to tier blobs to archive storage. Support blobs currently at Hot or Cool tier + // The function to tier blobs to archive storage. TierToArchive *DateAfterModification `json:"tierToArchive,omitempty"` - // The function to tier blobs to cool storage. Support blobs currently at Hot tier + // The function to tier blobs to cold storage. + TierToCold *DateAfterModification `json:"tierToCold,omitempty"` + + // The function to tier blobs to cool storage. TierToCool *DateAfterModification `json:"tierToCool,omitempty"` + + // The function to tier blobs to hot storage. This action can only be used with Premium Block Blob Storage Accounts + TierToHot *DateAfterModification `json:"tierToHot,omitempty"` } // ManagementPolicyDefinition - An object that defines the Lifecycle rule. Each definition is made up with a filters set and @@ -2303,11 +2296,17 @@ type ManagementPolicySnapShot struct { // The function to delete the blob snapshot Delete *DateAfterCreation `json:"delete,omitempty"` - // The function to tier blob snapshot to archive storage. Support blob snapshot currently at Hot or Cool tier + // The function to tier blob snapshot to archive storage. TierToArchive *DateAfterCreation `json:"tierToArchive,omitempty"` - // The function to tier blob snapshot to cool storage. Support blob snapshot currently at Hot tier + // The function to tier blobs to cold storage. + TierToCold *DateAfterCreation `json:"tierToCold,omitempty"` + + // The function to tier blob snapshot to cool storage. TierToCool *DateAfterCreation `json:"tierToCool,omitempty"` + + // The function to tier blobs to hot storage. This action can only be used with Premium Block Blob Storage Accounts + TierToHot *DateAfterCreation `json:"tierToHot,omitempty"` } // ManagementPolicyVersion - Management policy action for blob version. @@ -2315,11 +2314,17 @@ type ManagementPolicyVersion struct { // The function to delete the blob version Delete *DateAfterCreation `json:"delete,omitempty"` - // The function to tier blob version to archive storage. Support blob version currently at Hot or Cool tier + // The function to tier blob version to archive storage. TierToArchive *DateAfterCreation `json:"tierToArchive,omitempty"` - // The function to tier blob version to cool storage. Support blob version currently at Hot tier + // The function to tier blobs to cold storage. + TierToCold *DateAfterCreation `json:"tierToCold,omitempty"` + + // The function to tier blob version to cool storage. TierToCool *DateAfterCreation `json:"tierToCool,omitempty"` + + // The function to tier blobs to hot storage. This action can only be used with Premium Block Blob Storage Accounts + TierToHot *DateAfterCreation `json:"tierToHot,omitempty"` } // MetricSpecification - Metric specification of operation. diff --git a/sdk/resourcemanager/storage/armstorage/models_serde.go b/sdk/resourcemanager/storage/armstorage/models_serde.go index f03ee664d4af..f86677a29619 100644 --- a/sdk/resourcemanager/storage/armstorage/models_serde.go +++ b/sdk/resourcemanager/storage/armstorage/models_serde.go @@ -1685,72 +1685,6 @@ func (c *CheckNameAvailabilityResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CloudError. -func (c CloudError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "error", c.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudError. -func (c *CloudError) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &c.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CloudErrorBody. -func (c CloudErrorBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", c.Code) - populate(objectMap, "details", c.Details) - populate(objectMap, "message", c.Message) - populate(objectMap, "target", c.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudErrorBody. -func (c *CloudErrorBody) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &c.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &c.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &c.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &c.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ContainerProperties. func (c ContainerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -4238,7 +4172,9 @@ func (m ManagementPolicyBaseBlob) MarshalJSON() ([]byte, error) { populate(objectMap, "delete", m.Delete) populate(objectMap, "enableAutoTierToHotFromCool", m.EnableAutoTierToHotFromCool) populate(objectMap, "tierToArchive", m.TierToArchive) + populate(objectMap, "tierToCold", m.TierToCold) populate(objectMap, "tierToCool", m.TierToCool) + populate(objectMap, "tierToHot", m.TierToHot) return json.Marshal(objectMap) } @@ -4260,9 +4196,15 @@ func (m *ManagementPolicyBaseBlob) UnmarshalJSON(data []byte) error { case "tierToArchive": err = unpopulate(val, "TierToArchive", &m.TierToArchive) delete(rawMsg, key) + case "tierToCold": + err = unpopulate(val, "TierToCold", &m.TierToCold) + delete(rawMsg, key) case "tierToCool": err = unpopulate(val, "TierToCool", &m.TierToCool) delete(rawMsg, key) + case "tierToHot": + err = unpopulate(val, "TierToHot", &m.TierToHot) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -4439,7 +4381,9 @@ func (m ManagementPolicySnapShot) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "delete", m.Delete) populate(objectMap, "tierToArchive", m.TierToArchive) + populate(objectMap, "tierToCold", m.TierToCold) populate(objectMap, "tierToCool", m.TierToCool) + populate(objectMap, "tierToHot", m.TierToHot) return json.Marshal(objectMap) } @@ -4458,9 +4402,15 @@ func (m *ManagementPolicySnapShot) UnmarshalJSON(data []byte) error { case "tierToArchive": err = unpopulate(val, "TierToArchive", &m.TierToArchive) delete(rawMsg, key) + case "tierToCold": + err = unpopulate(val, "TierToCold", &m.TierToCold) + delete(rawMsg, key) case "tierToCool": err = unpopulate(val, "TierToCool", &m.TierToCool) delete(rawMsg, key) + case "tierToHot": + err = unpopulate(val, "TierToHot", &m.TierToHot) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -4474,7 +4424,9 @@ func (m ManagementPolicyVersion) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "delete", m.Delete) populate(objectMap, "tierToArchive", m.TierToArchive) + populate(objectMap, "tierToCold", m.TierToCold) populate(objectMap, "tierToCool", m.TierToCool) + populate(objectMap, "tierToHot", m.TierToHot) return json.Marshal(objectMap) } @@ -4493,9 +4445,15 @@ func (m *ManagementPolicyVersion) UnmarshalJSON(data []byte) error { case "tierToArchive": err = unpopulate(val, "TierToArchive", &m.TierToArchive) delete(rawMsg, key) + case "tierToCold": + err = unpopulate(val, "TierToCold", &m.TierToCold) + delete(rawMsg, key) case "tierToCool": err = unpopulate(val, "TierToCool", &m.TierToCool) delete(rawMsg, key) + case "tierToHot": + err = unpopulate(val, "TierToHot", &m.TierToHot) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) diff --git a/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client.go b/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client.go index 38c849f1a627..a004071b7e43 100644 --- a/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client.go +++ b/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client.go @@ -57,7 +57,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-05-01 +// Generated from API version 2022-09-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 *ObjectReplicationPoliciesClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, properties) @@ -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-05-01 +// Generated from API version 2022-09-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. @@ -171,7 +171,7 @@ func (client *ObjectReplicationPoliciesClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -179,7 +179,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-05-01 +// Generated from API version 2022-09-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 *ObjectReplicationPoliciesClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -243,8 +243,7 @@ func (client *ObjectReplicationPoliciesClient) getHandleResponse(resp *http.Resp } // NewListPager - List the object replication policies associated with the storage account. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -292,7 +291,7 @@ func (client *ObjectReplicationPoliciesClient) listCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-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 deleted file mode 100644 index 901262c61f58..000000000000 --- a/sdk/resourcemanager/storage/armstorage/objectreplicationpolicies_client_example_test.go +++ /dev/null @@ -1,227 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountListObjectReplicationPolicies.json -func ExampleObjectReplicationPoliciesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewObjectReplicationPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("res6977", "sto2527", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountGetObjectReplicationPolicy.json -func ExampleObjectReplicationPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewObjectReplicationPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "res6977", "sto2527", "{objectReplicationPolicy-Id}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountCreateObjectReplicationPolicyOnDestination.json -func ExampleObjectReplicationPoliciesClient_CreateOrUpdate_storageAccountCreateObjectReplicationPolicyOnDestination() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewObjectReplicationPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "res7687", "dst112", "default", armstorage.ObjectReplicationPolicy{ - Properties: &armstorage.ObjectReplicationPolicyProperties{ - DestinationAccount: to.Ptr("dst112"), - Rules: []*armstorage.ObjectReplicationPolicyRule{ - { - DestinationContainer: to.Ptr("dcont139"), - Filters: &armstorage.ObjectReplicationPolicyFilter{ - PrefixMatch: []*string{ - to.Ptr("blobA"), - to.Ptr("blobB")}, - }, - SourceContainer: to.Ptr("scont139"), - }}, - SourceAccount: to.Ptr("src1122"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountCreateObjectReplicationPolicyOnSource.json -func ExampleObjectReplicationPoliciesClient_CreateOrUpdate_storageAccountCreateObjectReplicationPolicyOnSource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewObjectReplicationPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "res7687", "src1122", "2a20bb73-5717-4635-985a-5d4cf777438f", armstorage.ObjectReplicationPolicy{ - Properties: &armstorage.ObjectReplicationPolicyProperties{ - DestinationAccount: to.Ptr("dst112"), - Rules: []*armstorage.ObjectReplicationPolicyRule{ - { - DestinationContainer: to.Ptr("dcont139"), - Filters: &armstorage.ObjectReplicationPolicyFilter{ - MinCreationTime: to.Ptr("2020-02-19T16:05:00Z"), - PrefixMatch: []*string{ - to.Ptr("blobA"), - to.Ptr("blobB")}, - }, - RuleID: to.Ptr("d5d18a48-8801-4554-aeaa-74faf65f5ef9"), - SourceContainer: to.Ptr("scont139"), - }}, - SourceAccount: to.Ptr("src1122"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountUpdateObjectReplicationPolicyOnDestination.json -func ExampleObjectReplicationPoliciesClient_CreateOrUpdate_storageAccountUpdateObjectReplicationPolicyOnDestination() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewObjectReplicationPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "res7687", "dst112", "2a20bb73-5717-4635-985a-5d4cf777438f", armstorage.ObjectReplicationPolicy{ - Properties: &armstorage.ObjectReplicationPolicyProperties{ - DestinationAccount: to.Ptr("dst112"), - Rules: []*armstorage.ObjectReplicationPolicyRule{ - { - DestinationContainer: to.Ptr("dcont139"), - Filters: &armstorage.ObjectReplicationPolicyFilter{ - PrefixMatch: []*string{ - to.Ptr("blobA"), - to.Ptr("blobB")}, - }, - RuleID: to.Ptr("d5d18a48-8801-4554-aeaa-74faf65f5ef9"), - SourceContainer: to.Ptr("scont139"), - }, - { - DestinationContainer: to.Ptr("dcont179"), - SourceContainer: to.Ptr("scont179"), - }}, - SourceAccount: to.Ptr("src1122"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountUpdateObjectReplicationPolicyOnSource.json -func ExampleObjectReplicationPoliciesClient_CreateOrUpdate_storageAccountUpdateObjectReplicationPolicyOnSource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewObjectReplicationPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "res7687", "src1122", "2a20bb73-5717-4635-985a-5d4cf777438f", armstorage.ObjectReplicationPolicy{ - Properties: &armstorage.ObjectReplicationPolicyProperties{ - DestinationAccount: to.Ptr("dst112"), - Rules: []*armstorage.ObjectReplicationPolicyRule{ - { - DestinationContainer: to.Ptr("dcont139"), - Filters: &armstorage.ObjectReplicationPolicyFilter{ - PrefixMatch: []*string{ - to.Ptr("blobA"), - to.Ptr("blobB")}, - }, - RuleID: to.Ptr("d5d18a48-8801-4554-aeaa-74faf65f5ef9"), - SourceContainer: to.Ptr("scont139"), - }, - { - DestinationContainer: to.Ptr("dcont179"), - RuleID: to.Ptr("cfbb4bc2-8b60-429f-b05a-d1e0942b33b2"), - SourceContainer: to.Ptr("scont179"), - }}, - SourceAccount: to.Ptr("src1122"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountDeleteObjectReplicationPolicy.json -func ExampleObjectReplicationPoliciesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewObjectReplicationPoliciesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "res6977", "sto2527", "{objectReplicationPolicy-Id}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/storage/armstorage/operations_client.go b/sdk/resourcemanager/storage/armstorage/operations_client.go index da4ddc4b2f3a..eaa02deeff32 100644 --- a/sdk/resourcemanager/storage/armstorage/operations_client.go +++ b/sdk/resourcemanager/storage/armstorage/operations_client.go @@ -50,8 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all of the available Storage Rest API operations. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-01 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -83,7 +82,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-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 deleted file mode 100644 index 6c2f7cc30582..000000000000 --- a/sdk/resourcemanager/storage/armstorage/operations_client_example_test.go +++ /dev/null @@ -1,41 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/OperationsList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go b/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go index 5d5f23b3c3e7..17c0c838fff3 100644 --- a/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go +++ b/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client.go @@ -57,7 +57,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-05-01 +// Generated from API version 2022-09-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 *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -111,7 +111,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-05-01 +// Generated from API version 2022-09-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. @@ -157,7 +157,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -173,8 +173,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res } // NewListPager - List all the private endpoint connections associated with the storage account. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -222,7 +221,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -239,7 +238,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-05-01 +// Generated from API version 2022-09-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. @@ -286,7 +285,7 @@ func (client *PrivateEndpointConnectionsClient) putCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, properties) diff --git a/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client_example_test.go deleted file mode 100644 index 9d2777d453ce..000000000000 --- a/sdk/resourcemanager/storage/armstorage/privateendpointconnections_client_example_test.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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountListPrivateEndpointConnections.json -func ExamplePrivateEndpointConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewPrivateEndpointConnectionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("res6977", "sto2527", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountGetPrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewPrivateEndpointConnectionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "res6977", "sto2527", "{privateEndpointConnectionName}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountPutPrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_Put() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewPrivateEndpointConnectionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Put(ctx, "res7687", "sto9699", "{privateEndpointConnectionName}", armstorage.PrivateEndpointConnection{ - Properties: &armstorage.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armstorage.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Auto-Approved"), - Status: to.Ptr(armstorage.PrivateEndpointServiceConnectionStatusApproved), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountDeletePrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewPrivateEndpointConnectionsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "res6977", "sto2527", "{privateEndpointConnectionName}", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/storage/armstorage/privatelinkresources_client.go b/sdk/resourcemanager/storage/armstorage/privatelinkresources_client.go index f23ef046d394..b2a12c037a3a 100644 --- a/sdk/resourcemanager/storage/armstorage/privatelinkresources_client.go +++ b/sdk/resourcemanager/storage/armstorage/privatelinkresources_client.go @@ -57,7 +57,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-05-01 +// Generated from API version 2022-09-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 *PrivateLinkResourcesClient) listByStorageAccountCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-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 deleted file mode 100644 index 6ea2523bda6d..000000000000 --- a/sdk/resourcemanager/storage/armstorage/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,36 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountListPrivateLinkResources.json -func ExamplePrivateLinkResourcesClient_ListByStorageAccount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewPrivateLinkResourcesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListByStorageAccount(ctx, "res6977", "sto2527", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/storage/armstorage/queue_client.go b/sdk/resourcemanager/storage/armstorage/queue_client.go index d5c0dd3e91c6..a357f9f8ad08 100644 --- a/sdk/resourcemanager/storage/armstorage/queue_client.go +++ b/sdk/resourcemanager/storage/armstorage/queue_client.go @@ -57,7 +57,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-05-01 +// Generated from API version 2022-09-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. @@ -105,7 +105,7 @@ func (client *QueueClient) createCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, queue) @@ -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-05-01 +// Generated from API version 2022-09-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. @@ -169,7 +169,7 @@ func (client *QueueClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -177,7 +177,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-05-01 +// Generated from API version 2022-09-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. @@ -224,7 +224,7 @@ func (client *QueueClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,8 +240,7 @@ func (client *QueueClient) getHandleResponse(resp *http.Response) (QueueClientGe } // NewListPager - Gets a list of all the queues under the specified storage account -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -294,7 +293,7 @@ func (client *QueueClient) listCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") if options != nil && options.Maxpagesize != nil { reqQP.Set("$maxpagesize", *options.Maxpagesize) } @@ -317,7 +316,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-05-01 +// Generated from API version 2022-09-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. @@ -365,7 +364,7 @@ func (client *QueueClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, queue) diff --git a/sdk/resourcemanager/storage/armstorage/queue_client_example_test.go b/sdk/resourcemanager/storage/armstorage/queue_client_example_test.go deleted file mode 100644 index e3ea8274dd00..000000000000 --- a/sdk/resourcemanager/storage/armstorage/queue_client_example_test.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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/QueueOperationPut.json -func ExampleQueueClient_Create_queueOperationPut() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewQueueClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, "res3376", "sto328", "queue6185", armstorage.Queue{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/QueueOperationPutWithMetadata.json -func ExampleQueueClient_Create_queueOperationPutWithMetadata() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewQueueClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, "res3376", "sto328", "queue6185", armstorage.Queue{ - QueueProperties: &armstorage.QueueProperties{ - Metadata: map[string]*string{ - "sample1": to.Ptr("meta1"), - "sample2": to.Ptr("meta2"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/QueueOperationPatch.json -func ExampleQueueClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewQueueClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "res3376", "sto328", "queue6185", armstorage.Queue{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/QueueOperationGet.json -func ExampleQueueClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewQueueClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "res3376", "sto328", "queue6185", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/QueueOperationDelete.json -func ExampleQueueClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewQueueClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "res3376", "sto328", "queue6185", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/QueueOperationList.json -func ExampleQueueClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewQueueClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("res9290", "sto328", &armstorage.QueueClientListOptions{Maxpagesize: nil, - Filter: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/storage/armstorage/queueservices_client.go b/sdk/resourcemanager/storage/armstorage/queueservices_client.go index 9aefd353416a..a664e60408bc 100644 --- a/sdk/resourcemanager/storage/armstorage/queueservices_client.go +++ b/sdk/resourcemanager/storage/armstorage/queueservices_client.go @@ -58,7 +58,7 @@ func NewQueueServicesClient(subscriptionID string, credential azcore.TokenCreden // GetServiceProperties - Gets the properties of a storage account’s Queue service, including properties for Storage Analytics // and CORS (Cross-Origin Resource Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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 *QueueServicesClient) getServicePropertiesCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,7 +117,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-05-01 +// Generated from API version 2022-09-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. @@ -157,7 +157,7 @@ func (client *QueueServicesClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -175,7 +175,7 @@ func (client *QueueServicesClient) listHandleResponse(resp *http.Response) (Queu // SetServiceProperties - Sets the properties of a storage account’s Queue service, including properties for Storage Analytics // and CORS (Cross-Origin Resource Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -219,7 +219,7 @@ func (client *QueueServicesClient) setServicePropertiesCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/storage/armstorage/queueservices_client_example_test.go b/sdk/resourcemanager/storage/armstorage/queueservices_client_example_test.go deleted file mode 100644 index 2178e0060913..000000000000 --- a/sdk/resourcemanager/storage/armstorage/queueservices_client_example_test.go +++ /dev/null @@ -1,126 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/QueueServicesList.json -func ExampleQueueServicesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewQueueServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, "res9290", "sto1590", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/QueueServicesPut.json -func ExampleQueueServicesClient_SetServiceProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewQueueServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.SetServiceProperties(ctx, "res4410", "sto8607", armstorage.QueueServiceProperties{ - QueueServiceProperties: &armstorage.QueueServicePropertiesProperties{ - Cors: &armstorage.CorsRules{ - CorsRules: []*armstorage.CorsRule{ - { - AllowedHeaders: []*string{ - to.Ptr("x-ms-meta-abc"), - to.Ptr("x-ms-meta-data*"), - to.Ptr("x-ms-meta-target*")}, - AllowedMethods: []*armstorage.CorsRuleAllowedMethodsItem{ - to.Ptr(armstorage.CorsRuleAllowedMethodsItemGET), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemHEAD), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemPOST), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemOPTIONS), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemMERGE), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemPUT)}, - AllowedOrigins: []*string{ - to.Ptr("http://www.contoso.com"), - to.Ptr("http://www.fabrikam.com")}, - ExposedHeaders: []*string{ - to.Ptr("x-ms-meta-*")}, - MaxAgeInSeconds: to.Ptr[int32](100), - }, - { - AllowedHeaders: []*string{ - to.Ptr("*")}, - AllowedMethods: []*armstorage.CorsRuleAllowedMethodsItem{ - to.Ptr(armstorage.CorsRuleAllowedMethodsItemGET)}, - AllowedOrigins: []*string{ - to.Ptr("*")}, - ExposedHeaders: []*string{ - to.Ptr("*")}, - MaxAgeInSeconds: to.Ptr[int32](2), - }, - { - AllowedHeaders: []*string{ - to.Ptr("x-ms-meta-12345675754564*")}, - AllowedMethods: []*armstorage.CorsRuleAllowedMethodsItem{ - to.Ptr(armstorage.CorsRuleAllowedMethodsItemGET), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemPUT)}, - AllowedOrigins: []*string{ - to.Ptr("http://www.abc23.com"), - to.Ptr("https://www.fabrikam.com/*")}, - ExposedHeaders: []*string{ - to.Ptr("x-ms-meta-abc"), - to.Ptr("x-ms-meta-data*"), - to.Ptr("x-ms-meta-target*")}, - MaxAgeInSeconds: to.Ptr[int32](2000), - }}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/QueueServicesGet.json -func ExampleQueueServicesClient_GetServiceProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewQueueServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetServiceProperties(ctx, "res4410", "sto8607", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/storage/armstorage/skus_client.go b/sdk/resourcemanager/storage/armstorage/skus_client.go index 25c3c3136622..5222131a892c 100644 --- a/sdk/resourcemanager/storage/armstorage/skus_client.go +++ b/sdk/resourcemanager/storage/armstorage/skus_client.go @@ -56,8 +56,7 @@ func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, opt } // NewListPager - Lists the available SKUs supported by Microsoft.Storage for given subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-01 // options - SKUsClientListOptions contains the optional parameters for the SKUsClient.List method. func (client *SKUsClient) NewListPager(options *SKUsClientListOptions) *runtime.Pager[SKUsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SKUsClientListResponse]{ @@ -93,7 +92,7 @@ func (client *SKUsClient) listCreateRequest(ctx context.Context, options *SKUsCl return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-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 deleted file mode 100644 index 046fe81e8420..000000000000 --- a/sdk/resourcemanager/storage/armstorage/skus_client_example_test.go +++ /dev/null @@ -1,41 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/SKUList.json -func ExampleSKUsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewSKUsClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/storage/armstorage/table_client.go b/sdk/resourcemanager/storage/armstorage/table_client.go index 17e8a2f43dd7..a8662e24f8a5 100644 --- a/sdk/resourcemanager/storage/armstorage/table_client.go +++ b/sdk/resourcemanager/storage/armstorage/table_client.go @@ -57,7 +57,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-05-01 +// Generated from API version 2022-09-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 *TableClient) createCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-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-05-01 +// Generated from API version 2022-09-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. @@ -169,7 +169,7 @@ func (client *TableClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -177,7 +177,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-05-01 +// Generated from API version 2022-09-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. @@ -223,7 +223,7 @@ func (client *TableClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -239,8 +239,7 @@ func (client *TableClient) getHandleResponse(resp *http.Response) (TableClientGe } // NewListPager - Gets a list of all the tables under the specified storage account -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -293,7 +292,7 @@ func (client *TableClient) listCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -310,7 +309,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-05-01 +// Generated from API version 2022-09-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 +355,7 @@ func (client *TableClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-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 deleted file mode 100644 index fbf2b4bd76c7..000000000000 --- a/sdk/resourcemanager/storage/armstorage/table_client_example_test.go +++ /dev/null @@ -1,158 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/TableOperationPut.json -func ExampleTableClient_Create_tableOperationPut() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewTableClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, "res3376", "sto328", "table6185", &armstorage.TableClientCreateOptions{Parameters: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/TableOperationPutOrPatchAcls.json -func ExampleTableClient_Create_tableOperationPutOrPatchAcls() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewTableClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, "res3376", "sto328", "table6185", &armstorage.TableClientCreateOptions{Parameters: &armstorage.Table{ - TableProperties: &armstorage.TableProperties{ - SignedIdentifiers: []*armstorage.TableSignedIdentifier{ - { - AccessPolicy: &armstorage.TableAccessPolicy{ - ExpiryTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-20T08:49:37.0000000Z"); return t }()), - Permission: to.Ptr("raud"), - StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-17T08:49:37.0000000Z"); return t }()), - }, - ID: to.Ptr("MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI"), - }, - { - AccessPolicy: &armstorage.TableAccessPolicy{ - ExpiryTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-20T08:49:37.0000000Z"); return t }()), - Permission: to.Ptr("rad"), - StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-17T08:49:37.0000000Z"); return t }()), - }, - ID: to.Ptr("PTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODklMTI"), - }}, - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/TableOperationPatch.json -func ExampleTableClient_Update_tableOperationPatch() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewTableClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "res3376", "sto328", "table6185", &armstorage.TableClientUpdateOptions{Parameters: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/TableOperationGet.json -func ExampleTableClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewTableClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "res3376", "sto328", "table6185", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/TableOperationDelete.json -func ExampleTableClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewTableClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "res3376", "sto328", "table6185", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/TableOperationList.json -func ExampleTableClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewTableClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("res9290", "sto328", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/storage/armstorage/tableservices_client.go b/sdk/resourcemanager/storage/armstorage/tableservices_client.go index 6a9f58e2bfc6..7a04d1e710e7 100644 --- a/sdk/resourcemanager/storage/armstorage/tableservices_client.go +++ b/sdk/resourcemanager/storage/armstorage/tableservices_client.go @@ -58,7 +58,7 @@ func NewTableServicesClient(subscriptionID string, credential azcore.TokenCreden // GetServiceProperties - Gets the properties of a storage account’s Table service, including properties for Storage Analytics // and CORS (Cross-Origin Resource Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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 *TableServicesClient) getServicePropertiesCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,7 +117,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-05-01 +// Generated from API version 2022-09-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. @@ -157,7 +157,7 @@ func (client *TableServicesClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -175,7 +175,7 @@ func (client *TableServicesClient) listHandleResponse(resp *http.Response) (Tabl // SetServiceProperties - Sets the properties of a storage account’s Table service, including properties for Storage Analytics // and CORS (Cross-Origin Resource Sharing) rules. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-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. @@ -219,7 +219,7 @@ func (client *TableServicesClient) setServicePropertiesCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/storage/armstorage/tableservices_client_example_test.go b/sdk/resourcemanager/storage/armstorage/tableservices_client_example_test.go deleted file mode 100644 index 4a3a2ae8d047..000000000000 --- a/sdk/resourcemanager/storage/armstorage/tableservices_client_example_test.go +++ /dev/null @@ -1,126 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/TableServicesList.json -func ExampleTableServicesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewTableServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, "res9290", "sto1590", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/TableServicesPut.json -func ExampleTableServicesClient_SetServiceProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewTableServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.SetServiceProperties(ctx, "res4410", "sto8607", armstorage.TableServiceProperties{ - TableServiceProperties: &armstorage.TableServicePropertiesProperties{ - Cors: &armstorage.CorsRules{ - CorsRules: []*armstorage.CorsRule{ - { - AllowedHeaders: []*string{ - to.Ptr("x-ms-meta-abc"), - to.Ptr("x-ms-meta-data*"), - to.Ptr("x-ms-meta-target*")}, - AllowedMethods: []*armstorage.CorsRuleAllowedMethodsItem{ - to.Ptr(armstorage.CorsRuleAllowedMethodsItemGET), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemHEAD), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemPOST), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemOPTIONS), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemMERGE), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemPUT)}, - AllowedOrigins: []*string{ - to.Ptr("http://www.contoso.com"), - to.Ptr("http://www.fabrikam.com")}, - ExposedHeaders: []*string{ - to.Ptr("x-ms-meta-*")}, - MaxAgeInSeconds: to.Ptr[int32](100), - }, - { - AllowedHeaders: []*string{ - to.Ptr("*")}, - AllowedMethods: []*armstorage.CorsRuleAllowedMethodsItem{ - to.Ptr(armstorage.CorsRuleAllowedMethodsItemGET)}, - AllowedOrigins: []*string{ - to.Ptr("*")}, - ExposedHeaders: []*string{ - to.Ptr("*")}, - MaxAgeInSeconds: to.Ptr[int32](2), - }, - { - AllowedHeaders: []*string{ - to.Ptr("x-ms-meta-12345675754564*")}, - AllowedMethods: []*armstorage.CorsRuleAllowedMethodsItem{ - to.Ptr(armstorage.CorsRuleAllowedMethodsItemGET), - to.Ptr(armstorage.CorsRuleAllowedMethodsItemPUT)}, - AllowedOrigins: []*string{ - to.Ptr("http://www.abc23.com"), - to.Ptr("https://www.fabrikam.com/*")}, - ExposedHeaders: []*string{ - to.Ptr("x-ms-meta-abc"), - to.Ptr("x-ms-meta-data*"), - to.Ptr("x-ms-meta-target*")}, - MaxAgeInSeconds: to.Ptr[int32](2000), - }}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/TableServicesGet.json -func ExampleTableServicesClient_GetServiceProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewTableServicesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetServiceProperties(ctx, "res4410", "sto8607", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/storage/armstorage/usages_client.go b/sdk/resourcemanager/storage/armstorage/usages_client.go index b8f8ae1aaae8..1f12aeccbfd7 100644 --- a/sdk/resourcemanager/storage/armstorage/usages_client.go +++ b/sdk/resourcemanager/storage/armstorage/usages_client.go @@ -56,8 +56,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. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// Generated from API version 2022-09-01 // location - The location of the Azure Storage resource. // options - UsagesClientListByLocationOptions contains the optional parameters for the UsagesClient.ListByLocation method. func (client *UsagesClient) NewListByLocationPager(location string, options *UsagesClientListByLocationOptions) *runtime.Pager[UsagesClientListByLocationResponse] { @@ -98,7 +97,7 @@ func (client *UsagesClient) listByLocationCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2022-09-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 deleted file mode 100644 index 89ebc2ff7bc5..000000000000 --- a/sdk/resourcemanager/storage/armstorage/usages_client_example_test.go +++ /dev/null @@ -1,41 +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. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armstorage_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storage/resource-manager/Microsoft.Storage/stable/2022-05-01/examples/StorageAccountListLocationUsage.json -func ExampleUsagesClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstorage.NewUsagesClient("{subscription-id}", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByLocationPager("eastus2(stage)", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -}