diff --git a/sdk/resourcemanager/storagecache/armstoragecache/CHANGELOG.md b/sdk/resourcemanager/storagecache/armstoragecache/CHANGELOG.md index 8bc5a9ddfbc1..22e309fe10b9 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/CHANGELOG.md +++ b/sdk/resourcemanager/storagecache/armstoragecache/CHANGELOG.md @@ -1,5 +1,21 @@ # Release History +## 3.0.0 (2023-02-09) +### Breaking Changes + +- Operation `*CachesClient.Update` has been changed to LRO, use `*CachesClient.BeginUpdate` instead. +- Struct `CloudError` has been removed + +### Features Added + +- New function `*StorageTargetsClient.BeginRestoreDefaults(context.Context, string, string, string, *StorageTargetsClientBeginRestoreDefaultsOptions) (*runtime.Poller[StorageTargetsClientRestoreDefaultsResponse], error)` +- New struct `StorageTargetsClientRestoreDefaultsResponse` +- New field `VerificationTimer` in struct `BlobNfsTarget` +- New field `WriteBackTimer` in struct `BlobNfsTarget` +- New field `VerificationTimer` in struct `Nfs3Target` +- New field `WriteBackTimer` in struct `Nfs3Target` + + ## 2.0.0 (2022-07-06) ### Breaking Changes diff --git a/sdk/resourcemanager/storagecache/armstoragecache/ascoperations_client.go b/sdk/resourcemanager/storagecache/armstoragecache/ascoperations_client.go index 936d7ae4e8cf..87a83c53b4bd 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/ascoperations_client.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/ascoperations_client.go @@ -32,10 +32,10 @@ type AscOperationsClient struct { } // NewAscOperationsClient creates a new instance of AscOperationsClient with the specified values. -// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewAscOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AscOperationsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -58,10 +58,11 @@ func NewAscOperationsClient(subscriptionID string, credential azcore.TokenCreden // Get - Gets the status of an asynchronous operation for the Azure HPC Cache // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// location - The name of the region used to look up the operation. -// operationID - The operation id which uniquely identifies the asynchronous operation. -// options - AscOperationsClientGetOptions contains the optional parameters for the AscOperationsClient.Get method. +// +// Generated from API version 2023-01-01 +// - location - The name of the region used to look up the operation. +// - operationID - The operation id which uniquely identifies the asynchronous operation. +// - options - AscOperationsClientGetOptions contains the optional parameters for the AscOperationsClient.Get method. func (client *AscOperationsClient) Get(ctx context.Context, location string, operationID string, options *AscOperationsClientGetOptions) (AscOperationsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, location, operationID, options) if err != nil { @@ -97,7 +98,7 @@ func (client *AscOperationsClient) getCreateRequest(ctx context.Context, locatio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storagecache/armstoragecache/ascoperations_client_example_test.go b/sdk/resourcemanager/storagecache/armstoragecache/ascoperations_client_example_test.go deleted file mode 100644 index 132f835304be..000000000000 --- a/sdk/resourcemanager/storagecache/armstoragecache/ascoperations_client_example_test.go +++ /dev/null @@ -1,39 +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 armstoragecache_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagecache/armstoragecache/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/AscOperations_Get.json -func ExampleAscOperationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewAscOperationsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "westus", - "testoperationid", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/storagecache/armstoragecache/ascusages_client.go b/sdk/resourcemanager/storagecache/armstoragecache/ascusages_client.go index b5b1c6122e8d..4c7f996fb36e 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/ascusages_client.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/ascusages_client.go @@ -32,10 +32,10 @@ type AscUsagesClient struct { } // NewAscUsagesClient creates a new instance of AscUsagesClient with the specified values. -// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewAscUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AscUsagesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,10 +57,10 @@ func NewAscUsagesClient(subscriptionID string, credential azcore.TokenCredential } // NewListPager - Gets the quantity used and quota limit for resources -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// location - The name of the region to query for usage information. -// options - AscUsagesClientListOptions contains the optional parameters for the AscUsagesClient.List method. +// +// Generated from API version 2023-01-01 +// - location - The name of the region to query for usage information. +// - options - AscUsagesClientListOptions contains the optional parameters for the AscUsagesClient.NewListPager method. func (client *AscUsagesClient) NewListPager(location string, options *AscUsagesClientListOptions) *runtime.Pager[AscUsagesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[AscUsagesClientListResponse]{ More: func(page AscUsagesClientListResponse) bool { @@ -105,7 +105,7 @@ func (client *AscUsagesClient) listCreateRequest(ctx context.Context, location s return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storagecache/armstoragecache/ascusages_client_example_test.go b/sdk/resourcemanager/storagecache/armstoragecache/ascusages_client_example_test.go deleted file mode 100644 index b5d974ab6513..000000000000 --- a/sdk/resourcemanager/storagecache/armstoragecache/ascusages_client_example_test.go +++ /dev/null @@ -1,42 +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 armstoragecache_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagecache/armstoragecache/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/AscResourceUsages_Get.json -func ExampleAscUsagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewAscUsagesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("eastus", - 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/storagecache/armstoragecache/autorest.md b/sdk/resourcemanager/storagecache/armstoragecache/autorest.md index 2a198250ab88..3620fa4b1431 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/autorest.md +++ b/sdk/resourcemanager/storagecache/armstoragecache/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/f95b40108e41ad35bde8586a409cee6af65808fd/specification/storagecache/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/f95b40108e41ad35bde8586a409cee6af65808fd/specification/storagecache/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/storagecache/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/storagecache/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.0.0 +module-version: 3.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/storagecache/armstoragecache/caches_client.go b/sdk/resourcemanager/storagecache/armstoragecache/caches_client.go index 8eb51b247dbb..2c4e19f06af7 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/caches_client.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/caches_client.go @@ -32,10 +32,10 @@ type CachesClient struct { } // NewCachesClient creates a new instance of CachesClient with the specified values. -// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewCachesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CachesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -58,13 +58,14 @@ func NewCachesClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreateOrUpdate - Create or update a Cache. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// cache - Object containing the user-selectable properties of the new Cache. If read-only properties are included, they must -// match the existing values of those properties. -// options - CachesClientBeginCreateOrUpdateOptions contains the optional parameters for the CachesClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - cache - Object containing the user-selectable properties of the new Cache. If read-only properties are included, they must +// match the existing values of those properties. +// - options - CachesClientBeginCreateOrUpdateOptions contains the optional parameters for the CachesClient.BeginCreateOrUpdate +// method. func (client *CachesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, cacheName string, cache Cache, options *CachesClientBeginCreateOrUpdateOptions) (*runtime.Poller[CachesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, cacheName, cache, options) @@ -79,7 +80,8 @@ func (client *CachesClient) BeginCreateOrUpdate(ctx context.Context, resourceGro // CreateOrUpdate - Create or update a Cache. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *CachesClient) createOrUpdate(ctx context.Context, resourceGroupName string, cacheName string, cache Cache, options *CachesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, cacheName, cache, options) if err != nil { @@ -115,7 +117,7 @@ func (client *CachesClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, cache) @@ -123,10 +125,11 @@ func (client *CachesClient) createOrUpdateCreateRequest(ctx context.Context, res // BeginDebugInfo - Tells a Cache to write generate debug info for support to process. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// options - CachesClientBeginDebugInfoOptions contains the optional parameters for the CachesClient.BeginDebugInfo method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - options - CachesClientBeginDebugInfoOptions contains the optional parameters for the CachesClient.BeginDebugInfo method. func (client *CachesClient) BeginDebugInfo(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginDebugInfoOptions) (*runtime.Poller[CachesClientDebugInfoResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.debugInfo(ctx, resourceGroupName, cacheName, options) @@ -143,7 +146,8 @@ func (client *CachesClient) BeginDebugInfo(ctx context.Context, resourceGroupNam // DebugInfo - Tells a Cache to write generate debug info for support to process. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *CachesClient) debugInfo(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginDebugInfoOptions) (*http.Response, error) { req, err := client.debugInfoCreateRequest(ctx, resourceGroupName, cacheName, options) if err != nil { @@ -179,7 +183,7 @@ func (client *CachesClient) debugInfoCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -187,10 +191,11 @@ func (client *CachesClient) debugInfoCreateRequest(ctx context.Context, resource // BeginDelete - Schedules a Cache for deletion. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// options - CachesClientBeginDeleteOptions contains the optional parameters for the CachesClient.BeginDelete method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - options - CachesClientBeginDeleteOptions contains the optional parameters for the CachesClient.BeginDelete method. func (client *CachesClient) BeginDelete(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginDeleteOptions) (*runtime.Poller[CachesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, cacheName, options) @@ -205,7 +210,8 @@ func (client *CachesClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Schedules a Cache for deletion. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *CachesClient) deleteOperation(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, cacheName, options) if err != nil { @@ -241,7 +247,7 @@ func (client *CachesClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -250,10 +256,11 @@ func (client *CachesClient) deleteCreateRequest(ctx context.Context, resourceGro // BeginFlush - Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors // returned until the flush is complete. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// options - CachesClientBeginFlushOptions contains the optional parameters for the CachesClient.BeginFlush method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - options - CachesClientBeginFlushOptions contains the optional parameters for the CachesClient.BeginFlush method. func (client *CachesClient) BeginFlush(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginFlushOptions) (*runtime.Poller[CachesClientFlushResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.flush(ctx, resourceGroupName, cacheName, options) @@ -271,7 +278,8 @@ func (client *CachesClient) BeginFlush(ctx context.Context, resourceGroupName st // Flush - Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors returned // until the flush is complete. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *CachesClient) flush(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginFlushOptions) (*http.Response, error) { req, err := client.flushCreateRequest(ctx, resourceGroupName, cacheName, options) if err != nil { @@ -307,7 +315,7 @@ func (client *CachesClient) flushCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -315,10 +323,11 @@ func (client *CachesClient) flushCreateRequest(ctx context.Context, resourceGrou // Get - Returns a Cache. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// options - CachesClientGetOptions contains the optional parameters for the CachesClient.Get method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - options - CachesClientGetOptions contains the optional parameters for the CachesClient.Get method. func (client *CachesClient) Get(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientGetOptions) (CachesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, cacheName, options) if err != nil { @@ -354,7 +363,7 @@ func (client *CachesClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -370,9 +379,9 @@ func (client *CachesClient) getHandleResponse(resp *http.Response) (CachesClient } // NewListPager - Returns all Caches the user has access to under a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// options - CachesClientListOptions contains the optional parameters for the CachesClient.List method. +// +// Generated from API version 2023-01-01 +// - options - CachesClientListOptions contains the optional parameters for the CachesClient.NewListPager method. func (client *CachesClient) NewListPager(options *CachesClientListOptions) *runtime.Pager[CachesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[CachesClientListResponse]{ More: func(page CachesClientListResponse) bool { @@ -413,7 +422,7 @@ func (client *CachesClient) listCreateRequest(ctx context.Context, options *Cach return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -429,11 +438,11 @@ func (client *CachesClient) listHandleResponse(resp *http.Response) (CachesClien } // NewListByResourceGroupPager - Returns all Caches the user has access to under a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// options - CachesClientListByResourceGroupOptions contains the optional parameters for the CachesClient.ListByResourceGroup -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - options - CachesClientListByResourceGroupOptions contains the optional parameters for the CachesClient.NewListByResourceGroupPager +// method. func (client *CachesClient) NewListByResourceGroupPager(resourceGroupName string, options *CachesClientListByResourceGroupOptions) *runtime.Pager[CachesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[CachesClientListByResourceGroupResponse]{ More: func(page CachesClientListByResourceGroupResponse) bool { @@ -478,7 +487,7 @@ func (client *CachesClient) listByResourceGroupCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -495,11 +504,12 @@ func (client *CachesClient) listByResourceGroupHandleResponse(resp *http.Respons // BeginPausePrimingJob - Schedule a priming job to be paused. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// options - CachesClientBeginPausePrimingJobOptions contains the optional parameters for the CachesClient.BeginPausePrimingJob -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - options - CachesClientBeginPausePrimingJobOptions contains the optional parameters for the CachesClient.BeginPausePrimingJob +// method. func (client *CachesClient) BeginPausePrimingJob(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginPausePrimingJobOptions) (*runtime.Poller[CachesClientPausePrimingJobResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.pausePrimingJob(ctx, resourceGroupName, cacheName, options) @@ -516,7 +526,8 @@ func (client *CachesClient) BeginPausePrimingJob(ctx context.Context, resourceGr // PausePrimingJob - Schedule a priming job to be paused. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *CachesClient) pausePrimingJob(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginPausePrimingJobOptions) (*http.Response, error) { req, err := client.pausePrimingJobCreateRequest(ctx, resourceGroupName, cacheName, options) if err != nil { @@ -552,7 +563,7 @@ func (client *CachesClient) pausePrimingJobCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.PrimingJobID != nil { @@ -563,11 +574,12 @@ func (client *CachesClient) pausePrimingJobCreateRequest(ctx context.Context, re // BeginResumePrimingJob - Resumes a paused priming job. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// options - CachesClientBeginResumePrimingJobOptions contains the optional parameters for the CachesClient.BeginResumePrimingJob -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - options - CachesClientBeginResumePrimingJobOptions contains the optional parameters for the CachesClient.BeginResumePrimingJob +// method. func (client *CachesClient) BeginResumePrimingJob(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginResumePrimingJobOptions) (*runtime.Poller[CachesClientResumePrimingJobResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.resumePrimingJob(ctx, resourceGroupName, cacheName, options) @@ -584,7 +596,8 @@ func (client *CachesClient) BeginResumePrimingJob(ctx context.Context, resourceG // ResumePrimingJob - Resumes a paused priming job. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *CachesClient) resumePrimingJob(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginResumePrimingJobOptions) (*http.Response, error) { req, err := client.resumePrimingJobCreateRequest(ctx, resourceGroupName, cacheName, options) if err != nil { @@ -620,7 +633,7 @@ func (client *CachesClient) resumePrimingJobCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.PrimingJobID != nil { @@ -631,11 +644,12 @@ func (client *CachesClient) resumePrimingJobCreateRequest(ctx context.Context, r // BeginSpaceAllocation - Update cache space allocation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// options - CachesClientBeginSpaceAllocationOptions contains the optional parameters for the CachesClient.BeginSpaceAllocation -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - options - CachesClientBeginSpaceAllocationOptions contains the optional parameters for the CachesClient.BeginSpaceAllocation +// method. func (client *CachesClient) BeginSpaceAllocation(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginSpaceAllocationOptions) (*runtime.Poller[CachesClientSpaceAllocationResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.spaceAllocation(ctx, resourceGroupName, cacheName, options) @@ -652,7 +666,8 @@ func (client *CachesClient) BeginSpaceAllocation(ctx context.Context, resourceGr // SpaceAllocation - Update cache space allocation. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *CachesClient) spaceAllocation(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginSpaceAllocationOptions) (*http.Response, error) { req, err := client.spaceAllocationCreateRequest(ctx, resourceGroupName, cacheName, options) if err != nil { @@ -688,7 +703,7 @@ func (client *CachesClient) spaceAllocationCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.SpaceAllocation != nil { @@ -699,10 +714,11 @@ func (client *CachesClient) spaceAllocationCreateRequest(ctx context.Context, re // BeginStart - Tells a Stopped state Cache to transition to Active state. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// options - CachesClientBeginStartOptions contains the optional parameters for the CachesClient.BeginStart method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - options - CachesClientBeginStartOptions contains the optional parameters for the CachesClient.BeginStart method. func (client *CachesClient) BeginStart(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginStartOptions) (*runtime.Poller[CachesClientStartResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.start(ctx, resourceGroupName, cacheName, options) @@ -719,7 +735,8 @@ func (client *CachesClient) BeginStart(ctx context.Context, resourceGroupName st // Start - Tells a Stopped state Cache to transition to Active state. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *CachesClient) start(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginStartOptions) (*http.Response, error) { req, err := client.startCreateRequest(ctx, resourceGroupName, cacheName, options) if err != nil { @@ -755,7 +772,7 @@ func (client *CachesClient) startCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -763,11 +780,12 @@ func (client *CachesClient) startCreateRequest(ctx context.Context, resourceGrou // BeginStartPrimingJob - Create a priming job. This operation is only allowed when the cache is healthy. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// options - CachesClientBeginStartPrimingJobOptions contains the optional parameters for the CachesClient.BeginStartPrimingJob -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - options - CachesClientBeginStartPrimingJobOptions contains the optional parameters for the CachesClient.BeginStartPrimingJob +// method. func (client *CachesClient) BeginStartPrimingJob(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginStartPrimingJobOptions) (*runtime.Poller[CachesClientStartPrimingJobResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.startPrimingJob(ctx, resourceGroupName, cacheName, options) @@ -784,7 +802,8 @@ func (client *CachesClient) BeginStartPrimingJob(ctx context.Context, resourceGr // StartPrimingJob - Create a priming job. This operation is only allowed when the cache is healthy. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *CachesClient) startPrimingJob(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginStartPrimingJobOptions) (*http.Response, error) { req, err := client.startPrimingJobCreateRequest(ctx, resourceGroupName, cacheName, options) if err != nil { @@ -820,7 +839,7 @@ func (client *CachesClient) startPrimingJobCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Primingjob != nil { @@ -831,10 +850,11 @@ func (client *CachesClient) startPrimingJobCreateRequest(ctx context.Context, re // BeginStop - Tells an Active Cache to transition to Stopped state. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// options - CachesClientBeginStopOptions contains the optional parameters for the CachesClient.BeginStop method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - options - CachesClientBeginStopOptions contains the optional parameters for the CachesClient.BeginStop method. func (client *CachesClient) BeginStop(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginStopOptions) (*runtime.Poller[CachesClientStopResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.stop(ctx, resourceGroupName, cacheName, options) @@ -851,7 +871,8 @@ func (client *CachesClient) BeginStop(ctx context.Context, resourceGroupName str // Stop - Tells an Active Cache to transition to Stopped state. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *CachesClient) stop(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginStopOptions) (*http.Response, error) { req, err := client.stopCreateRequest(ctx, resourceGroupName, cacheName, options) if err != nil { @@ -887,7 +908,7 @@ func (client *CachesClient) stopCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -895,11 +916,12 @@ func (client *CachesClient) stopCreateRequest(ctx context.Context, resourceGroup // BeginStopPrimingJob - Schedule a priming job for deletion. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// options - CachesClientBeginStopPrimingJobOptions contains the optional parameters for the CachesClient.BeginStopPrimingJob -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - options - CachesClientBeginStopPrimingJobOptions contains the optional parameters for the CachesClient.BeginStopPrimingJob +// method. func (client *CachesClient) BeginStopPrimingJob(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginStopPrimingJobOptions) (*runtime.Poller[CachesClientStopPrimingJobResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.stopPrimingJob(ctx, resourceGroupName, cacheName, options) @@ -916,7 +938,8 @@ func (client *CachesClient) BeginStopPrimingJob(ctx context.Context, resourceGro // StopPrimingJob - Schedule a priming job for deletion. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *CachesClient) stopPrimingJob(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginStopPrimingJobOptions) (*http.Response, error) { req, err := client.stopPrimingJobCreateRequest(ctx, resourceGroupName, cacheName, options) if err != nil { @@ -952,7 +975,7 @@ func (client *CachesClient) stopPrimingJobCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.PrimingJobID != nil { @@ -961,31 +984,50 @@ func (client *CachesClient) stopPrimingJobCreateRequest(ctx context.Context, res return req, nil } +// BeginUpdate - Update a Cache instance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - cache - Object containing the user-selectable properties of the Cache. If read-only properties are included, they must +// match the existing values of those properties. +// - options - CachesClientBeginUpdateOptions contains the optional parameters for the CachesClient.BeginUpdate method. +func (client *CachesClient) BeginUpdate(ctx context.Context, resourceGroupName string, cacheName string, cache Cache, options *CachesClientBeginUpdateOptions) (*runtime.Poller[CachesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, cacheName, cache, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[CachesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[CachesClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + // Update - Update a Cache instance. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// cache - Object containing the user-selectable properties of the Cache. If read-only properties are included, they must -// match the existing values of those properties. -// options - CachesClientUpdateOptions contains the optional parameters for the CachesClient.Update method. -func (client *CachesClient) Update(ctx context.Context, resourceGroupName string, cacheName string, cache Cache, options *CachesClientUpdateOptions) (CachesClientUpdateResponse, error) { +// +// Generated from API version 2023-01-01 +func (client *CachesClient) update(ctx context.Context, resourceGroupName string, cacheName string, cache Cache, options *CachesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, cacheName, cache, options) if err != nil { - return CachesClientUpdateResponse{}, err + return nil, err } resp, err := client.pl.Do(req) if err != nil { - return CachesClientUpdateResponse{}, err + return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CachesClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) } - return client.updateHandleResponse(resp) + return resp, nil } // updateCreateRequest creates the Update request. -func (client *CachesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, cacheName string, cache Cache, options *CachesClientUpdateOptions) (*policy.Request, error) { +func (client *CachesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, cacheName string, cache Cache, options *CachesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1004,28 +1046,20 @@ func (client *CachesClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, cache) } -// updateHandleResponse handles the Update response. -func (client *CachesClient) updateHandleResponse(resp *http.Response) (CachesClientUpdateResponse, error) { - result := CachesClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Cache); err != nil { - return CachesClientUpdateResponse{}, err - } - return result, nil -} - // BeginUpgradeFirmware - Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// options - CachesClientBeginUpgradeFirmwareOptions contains the optional parameters for the CachesClient.BeginUpgradeFirmware -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - options - CachesClientBeginUpgradeFirmwareOptions contains the optional parameters for the CachesClient.BeginUpgradeFirmware +// method. func (client *CachesClient) BeginUpgradeFirmware(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginUpgradeFirmwareOptions) (*runtime.Poller[CachesClientUpgradeFirmwareResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.upgradeFirmware(ctx, resourceGroupName, cacheName, options) @@ -1042,7 +1076,8 @@ func (client *CachesClient) BeginUpgradeFirmware(ctx context.Context, resourceGr // UpgradeFirmware - Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *CachesClient) upgradeFirmware(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginUpgradeFirmwareOptions) (*http.Response, error) { req, err := client.upgradeFirmwareCreateRequest(ctx, resourceGroupName, cacheName, options) if err != nil { @@ -1078,7 +1113,7 @@ func (client *CachesClient) upgradeFirmwareCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storagecache/armstoragecache/caches_client_example_test.go b/sdk/resourcemanager/storagecache/armstoragecache/caches_client_example_test.go deleted file mode 100644 index cc3f7796d3e0..000000000000 --- a/sdk/resourcemanager/storagecache/armstoragecache/caches_client_example_test.go +++ /dev/null @@ -1,578 +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 armstoragecache_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/storagecache/armstoragecache/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_List.json -func ExampleCachesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewCachesClient("00000000-0000-0000-0000-000000000000", 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_ListByResourceGroup.json -func ExampleCachesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewCachesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("scgroup", - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_Delete.json -func ExampleCachesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewCachesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "scgroup", - "sc", - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_Get.json -func ExampleCachesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewCachesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "scgroup", - "sc1", - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_CreateOrUpdate.json -func ExampleCachesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewCachesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "scgroup", - "sc1", - armstoragecache.Cache{ - Identity: &armstoragecache.CacheIdentity{ - Type: to.Ptr(armstoragecache.CacheIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armstoragecache.UserAssignedIdentitiesValue{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": {}, - }, - }, - Location: to.Ptr("westus"), - Properties: &armstoragecache.CacheProperties{ - CacheSizeGB: to.Ptr[int32](3072), - DirectoryServicesSettings: &armstoragecache.CacheDirectorySettings{ - ActiveDirectory: &armstoragecache.CacheActiveDirectorySettings{ - CacheNetBiosName: to.Ptr("contosoSmb"), - Credentials: &armstoragecache.CacheActiveDirectorySettingsCredentials{ - Password: to.Ptr(""), - Username: to.Ptr("consotoAdmin"), - }, - DomainName: to.Ptr("contosoAd.contoso.local"), - DomainNetBiosName: to.Ptr("contosoAd"), - PrimaryDNSIPAddress: to.Ptr("192.0.2.10"), - SecondaryDNSIPAddress: to.Ptr("192.0.2.11"), - }, - UsernameDownload: &armstoragecache.CacheUsernameDownloadSettings{ - Credentials: &armstoragecache.CacheUsernameDownloadSettingsCredentials{ - BindDn: to.Ptr("cn=ldapadmin,dc=contosoad,dc=contoso,dc=local"), - BindPassword: to.Ptr(""), - }, - ExtendedGroups: to.Ptr(true), - LdapBaseDN: to.Ptr("dc=contosoad,dc=contoso,dc=local"), - LdapServer: to.Ptr("192.0.2.12"), - UsernameSource: to.Ptr(armstoragecache.UsernameSourceLDAP), - }, - }, - EncryptionSettings: &armstoragecache.CacheEncryptionSettings{ - KeyEncryptionKey: &armstoragecache.KeyVaultKeyReference{ - KeyURL: to.Ptr("https://keyvault-cmk.vault.azure.net/keys/key2047/test"), - SourceVault: &armstoragecache.KeyVaultKeyReferenceSourceVault{ - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.KeyVault/vaults/keyvault-cmk"), - }, - }, - }, - SecuritySettings: &armstoragecache.CacheSecuritySettings{ - AccessPolicies: []*armstoragecache.NfsAccessPolicy{ - { - Name: to.Ptr("default"), - AccessRules: []*armstoragecache.NfsAccessRule{ - { - Access: to.Ptr(armstoragecache.NfsAccessRuleAccessRw), - RootSquash: to.Ptr(false), - Scope: to.Ptr(armstoragecache.NfsAccessRuleScopeDefault), - SubmountAccess: to.Ptr(true), - Suid: to.Ptr(false), - }}, - }}, - }, - Subnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/sub1"), - UpgradeSettings: &armstoragecache.CacheUpgradeSettings{ - ScheduledTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-26T18:25:43.511Z"); return t }()), - UpgradeScheduleEnabled: to.Ptr(true), - }, - }, - SKU: &armstoragecache.CacheSKU{ - Name: to.Ptr("Standard_2G"), - }, - Tags: map[string]*string{ - "Dept": to.Ptr("Contoso"), - }, - }, - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_Update.json -func ExampleCachesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewCachesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "scgroup", - "sc1", - armstoragecache.Cache{ - Location: to.Ptr("westus"), - Properties: &armstoragecache.CacheProperties{ - CacheSizeGB: to.Ptr[int32](3072), - DirectoryServicesSettings: &armstoragecache.CacheDirectorySettings{ - ActiveDirectory: &armstoragecache.CacheActiveDirectorySettings{ - CacheNetBiosName: to.Ptr("contosoSmb"), - DomainName: to.Ptr("contosoAd.contoso.local"), - DomainNetBiosName: to.Ptr("contosoAd"), - PrimaryDNSIPAddress: to.Ptr("192.0.2.10"), - SecondaryDNSIPAddress: to.Ptr("192.0.2.11"), - }, - UsernameDownload: &armstoragecache.CacheUsernameDownloadSettings{ - ExtendedGroups: to.Ptr(true), - UsernameSource: to.Ptr(armstoragecache.UsernameSourceAD), - }, - }, - NetworkSettings: &armstoragecache.CacheNetworkSettings{ - DNSSearchDomain: to.Ptr("contoso.com"), - DNSServers: []*string{ - to.Ptr("10.1.22.33"), - to.Ptr("10.1.12.33")}, - Mtu: to.Ptr[int32](1500), - NtpServer: to.Ptr("time.contoso.com"), - }, - SecuritySettings: &armstoragecache.CacheSecuritySettings{ - AccessPolicies: []*armstoragecache.NfsAccessPolicy{ - { - Name: to.Ptr("default"), - AccessRules: []*armstoragecache.NfsAccessRule{ - { - Access: to.Ptr(armstoragecache.NfsAccessRuleAccessRw), - RootSquash: to.Ptr(false), - Scope: to.Ptr(armstoragecache.NfsAccessRuleScopeDefault), - SubmountAccess: to.Ptr(true), - Suid: to.Ptr(false), - }}, - }, - { - Name: to.Ptr("restrictive"), - AccessRules: []*armstoragecache.NfsAccessRule{ - { - Access: to.Ptr(armstoragecache.NfsAccessRuleAccessRw), - Filter: to.Ptr("10.99.3.145"), - RootSquash: to.Ptr(false), - Scope: to.Ptr(armstoragecache.NfsAccessRuleScopeHost), - SubmountAccess: to.Ptr(true), - Suid: to.Ptr(true), - }, - { - Access: to.Ptr(armstoragecache.NfsAccessRuleAccessRw), - Filter: to.Ptr("10.99.1.0/24"), - RootSquash: to.Ptr(false), - Scope: to.Ptr(armstoragecache.NfsAccessRuleScopeNetwork), - SubmountAccess: to.Ptr(true), - Suid: to.Ptr(true), - }, - { - Access: to.Ptr(armstoragecache.NfsAccessRuleAccessNo), - AnonymousGID: to.Ptr("65534"), - AnonymousUID: to.Ptr("65534"), - RootSquash: to.Ptr(true), - Scope: to.Ptr(armstoragecache.NfsAccessRuleScopeDefault), - SubmountAccess: to.Ptr(true), - Suid: to.Ptr(false), - }}, - }}, - }, - Subnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/sub1"), - UpgradeSettings: &armstoragecache.CacheUpgradeSettings{ - ScheduledTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-04-26T18:25:43.511Z"); return t }()), - UpgradeScheduleEnabled: to.Ptr(true), - }, - }, - SKU: &armstoragecache.CacheSKU{ - Name: to.Ptr("Standard_2G"), - }, - Tags: map[string]*string{ - "Dept": to.Ptr("Contoso"), - }, - }, - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_DebugInfo.json -func ExampleCachesClient_BeginDebugInfo() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewCachesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDebugInfo(ctx, - "scgroup", - "sc", - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_Flush.json -func ExampleCachesClient_BeginFlush() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewCachesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginFlush(ctx, - "scgroup", - "sc", - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_Start.json -func ExampleCachesClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewCachesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStart(ctx, - "scgroup", - "sc", - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_Stop.json -func ExampleCachesClient_BeginStop() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewCachesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStop(ctx, - "scgroup", - "sc", - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StartPrimingJob.json -func ExampleCachesClient_BeginStartPrimingJob() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewCachesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStartPrimingJob(ctx, - "scgroup", - "sc1", - &armstoragecache.CachesClientBeginStartPrimingJobOptions{Primingjob: &armstoragecache.PrimingJob{ - PrimingJobName: to.Ptr("contosoJob"), - PrimingManifestURL: to.Ptr("https://contosostorage.blob.core.windows.net/contosoblob/00000000_00000000000000000000000000000000.00000000000.FFFFFFFF.00000000?sp=r&st=2021-08-11T19:33:35Z&se=2021-08-12T03:33:35Z&spr=https&sv=2020-08-04&sr=b&sig="), - }, - }) - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StopPrimingJob.json -func ExampleCachesClient_BeginStopPrimingJob() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewCachesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStopPrimingJob(ctx, - "scgroup", - "sc1", - &armstoragecache.CachesClientBeginStopPrimingJobOptions{PrimingJobID: &armstoragecache.PrimingJobIDParameter{ - PrimingJobID: to.Ptr("00000000000_0000000000"), - }, - }) - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/PausePrimingJob.json -func ExampleCachesClient_BeginPausePrimingJob() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewCachesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginPausePrimingJob(ctx, - "scgroup", - "sc1", - &armstoragecache.CachesClientBeginPausePrimingJobOptions{PrimingJobID: &armstoragecache.PrimingJobIDParameter{ - PrimingJobID: to.Ptr("00000000000_0000000000"), - }, - }) - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/ResumePrimingJob.json -func ExampleCachesClient_BeginResumePrimingJob() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewCachesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginResumePrimingJob(ctx, - "scgroup", - "sc1", - &armstoragecache.CachesClientBeginResumePrimingJobOptions{PrimingJobID: &armstoragecache.PrimingJobIDParameter{ - PrimingJobID: to.Ptr("00000000000_0000000000"), - }, - }) - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Caches_UpgradeFirmware.json -func ExampleCachesClient_BeginUpgradeFirmware() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewCachesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpgradeFirmware(ctx, - "scgroup", - "sc1", - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/SpaceAllocation_Post.json -func ExampleCachesClient_BeginSpaceAllocation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewCachesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginSpaceAllocation(ctx, - "scgroup", - "sc1", - &armstoragecache.CachesClientBeginSpaceAllocationOptions{SpaceAllocation: []*armstoragecache.StorageTargetSpaceAllocation{ - { - Name: to.Ptr("st1"), - AllocationPercentage: to.Ptr[int32](25), - }, - { - Name: to.Ptr("st2"), - AllocationPercentage: to.Ptr[int32](50), - }, - { - Name: to.Ptr("st3"), - AllocationPercentage: to.Ptr[int32](25), - }}, - }) - 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/storagecache/armstoragecache/constants.go b/sdk/resourcemanager/storagecache/armstoragecache/constants.go index c2b8c80ab594..93f392a218bc 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/constants.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/constants.go @@ -11,7 +11,7 @@ package armstoragecache const ( moduleName = "armstoragecache" - moduleVersion = "v2.0.0" + moduleVersion = "v3.0.0" ) // CacheIdentityType - The type of identity used for the cache diff --git a/sdk/resourcemanager/storagecache/armstoragecache/go.mod b/sdk/resourcemanager/storagecache/armstoragecache/go.mod index 4f5ac4a02b7d..9bbf0ce5c9c6 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/go.mod +++ b/sdk/resourcemanager/storagecache/armstoragecache/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagecache/armstoragecache/v2 +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagecache/armstoragecache/v3 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.1.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/storagecache/armstoragecache/go.sum b/sdk/resourcemanager/storagecache/armstoragecache/go.sum index 8828b17b1853..3afb578030a5 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/go.sum +++ b/sdk/resourcemanager/storagecache/armstoragecache/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/storagecache/armstoragecache/models.go b/sdk/resourcemanager/storagecache/armstoragecache/models.go index e02a0abaff9e..8d258408a43c 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/models.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/models.go @@ -96,7 +96,7 @@ type AscOperation struct { // AscOperationProperties - Additional operation-specific output. type AscOperationProperties struct { // Additional operation-specific output. - Output map[string]interface{} `json:"output,omitempty"` + Output map[string]any `json:"output,omitempty"` } // AscOperationsClientGetOptions contains the optional parameters for the AscOperationsClient.Get method. @@ -104,7 +104,7 @@ type AscOperationsClientGetOptions struct { // placeholder for future optional parameters } -// AscUsagesClientListOptions contains the optional parameters for the AscUsagesClient.List method. +// AscUsagesClientListOptions contains the optional parameters for the AscUsagesClient.NewListPager method. type AscUsagesClientListOptions struct { // placeholder for future optional parameters } @@ -116,6 +116,12 @@ type BlobNfsTarget struct { // Identifies the StorageCache usage model to be used for this storage target. UsageModel *string `json:"usageModel,omitempty"` + + // Amount of time (in seconds) the cache waits before it checks the back-end storage for file updates. + VerificationTimer *int32 `json:"verificationTimer,omitempty"` + + // Amount of time (in seconds) the cache waits after the last file change before it copies the changed file to back-end storage. + WriteBackTimer *int32 `json:"writeBackTimer,omitempty"` } // Cache - A Cache instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md @@ -463,6 +469,12 @@ type CachesClientBeginStopPrimingJobOptions struct { ResumeToken string } +// CachesClientBeginUpdateOptions contains the optional parameters for the CachesClient.BeginUpdate method. +type CachesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // CachesClientBeginUpgradeFirmwareOptions contains the optional parameters for the CachesClient.BeginUpgradeFirmware method. type CachesClientBeginUpgradeFirmwareOptions struct { // Resumes the LRO from the provided token. @@ -474,21 +486,17 @@ type CachesClientGetOptions struct { // placeholder for future optional parameters } -// CachesClientListByResourceGroupOptions contains the optional parameters for the CachesClient.ListByResourceGroup method. +// CachesClientListByResourceGroupOptions contains the optional parameters for the CachesClient.NewListByResourceGroupPager +// method. type CachesClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// CachesClientListOptions contains the optional parameters for the CachesClient.List method. +// CachesClientListOptions contains the optional parameters for the CachesClient.NewListPager method. type CachesClientListOptions struct { // placeholder for future optional parameters } -// CachesClientUpdateOptions contains the optional parameters for the CachesClient.Update method. -type CachesClientUpdateOptions struct { - // placeholder for future optional parameters -} - // CachesListResult - Result of the request to list Caches. It contains a list of Caches and a URL link to get the next set // of results. type CachesListResult struct { @@ -505,12 +513,6 @@ type ClfsTarget struct { Target *string `json:"target,omitempty"` } -// CloudError - An error response. -type CloudError struct { - // The body of the error. - Error *CloudErrorBody `json:"error,omitempty"` -} - // CloudErrorBody - An error response. type CloudErrorBody struct { // An identifier for the error. Codes are invariant and are intended to be consumed programmatically. @@ -632,6 +634,12 @@ type Nfs3Target struct { // Identifies the StorageCache usage model to be used for this storage target. UsageModel *string `json:"usageModel,omitempty"` + + // Amount of time (in seconds) the cache waits before it checks the back-end storage for file updates. + VerificationTimer *int32 `json:"verificationTimer,omitempty"` + + // Amount of time (in seconds) the cache waits after the last file change before it copies the changed file to back-end storage. + WriteBackTimer *int32 `json:"writeBackTimer,omitempty"` } // NfsAccessPolicy - A set of rules describing access policies applied to NFSv3 clients of the cache. @@ -674,7 +682,7 @@ type NfsAccessRule struct { Suid *bool `json:"suid,omitempty"` } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } @@ -809,7 +817,7 @@ type Restriction struct { Values []*string `json:"values,omitempty" azure:"ro"` } -// SKUsClientListOptions contains the optional parameters for the SKUsClient.List method. +// SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. type SKUsClientListOptions struct { // placeholder for future optional parameters } @@ -940,12 +948,20 @@ type StorageTargetsClientBeginDeleteOptions struct { ResumeToken string } +// StorageTargetsClientBeginRestoreDefaultsOptions contains the optional parameters for the StorageTargetsClient.BeginRestoreDefaults +// method. +type StorageTargetsClientBeginRestoreDefaultsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // StorageTargetsClientGetOptions contains the optional parameters for the StorageTargetsClient.Get method. type StorageTargetsClientGetOptions struct { // placeholder for future optional parameters } -// StorageTargetsClientListByCacheOptions contains the optional parameters for the StorageTargetsClient.ListByCache method. +// StorageTargetsClientListByCacheOptions contains the optional parameters for the StorageTargetsClient.NewListByCachePager +// method. type StorageTargetsClientListByCacheOptions struct { // placeholder for future optional parameters } @@ -1004,7 +1020,7 @@ type UsageModelDisplay struct { Description *string `json:"description,omitempty"` } -// UsageModelsClientListOptions contains the optional parameters for the UsageModelsClient.List method. +// UsageModelsClientListOptions contains the optional parameters for the UsageModelsClient.NewListPager method. type UsageModelsClientListOptions struct { // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/storagecache/armstoragecache/models_serde.go b/sdk/resourcemanager/storagecache/armstoragecache/models_serde.go index 5c54979d4b2d..65d6aae302f8 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/models_serde.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/models_serde.go @@ -18,7 +18,7 @@ import ( // MarshalJSON implements the json.Marshaller interface for type APIOperation. func (a APIOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "display", a.Display) populate(objectMap, "isDataAction", a.IsDataAction) populate(objectMap, "name", a.Name) @@ -61,7 +61,7 @@ func (a *APIOperation) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type APIOperationDisplay. func (a APIOperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "description", a.Description) populate(objectMap, "operation", a.Operation) populate(objectMap, "provider", a.Provider) @@ -100,7 +100,7 @@ func (a *APIOperationDisplay) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type APIOperationListResult. func (a APIOperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", a.NextLink) populate(objectMap, "value", a.Value) return json.Marshal(objectMap) @@ -131,7 +131,7 @@ func (a *APIOperationListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type APIOperationProperties. func (a APIOperationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "serviceSpecification", a.ServiceSpecification) return json.Marshal(objectMap) } @@ -158,7 +158,7 @@ func (a *APIOperationProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type APIOperationPropertiesServiceSpecification. func (a APIOperationPropertiesServiceSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "logSpecifications", a.LogSpecifications) populate(objectMap, "metricSpecifications", a.MetricSpecifications) return json.Marshal(objectMap) @@ -189,7 +189,7 @@ func (a *APIOperationPropertiesServiceSpecification) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type AscOperation. func (a AscOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "endTime", a.EndTime) populate(objectMap, "error", a.Error) populate(objectMap, "id", a.ID) @@ -240,7 +240,7 @@ func (a *AscOperation) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AscOperationProperties. func (a AscOperationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "output", a.Output) return json.Marshal(objectMap) } @@ -267,9 +267,11 @@ func (a *AscOperationProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BlobNfsTarget. func (b BlobNfsTarget) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "target", b.Target) populate(objectMap, "usageModel", b.UsageModel) + populate(objectMap, "verificationTimer", b.VerificationTimer) + populate(objectMap, "writeBackTimer", b.WriteBackTimer) return json.Marshal(objectMap) } @@ -288,6 +290,12 @@ func (b *BlobNfsTarget) UnmarshalJSON(data []byte) error { case "usageModel": err = unpopulate(val, "UsageModel", &b.UsageModel) delete(rawMsg, key) + case "verificationTimer": + err = unpopulate(val, "VerificationTimer", &b.VerificationTimer) + delete(rawMsg, key) + case "writeBackTimer": + err = unpopulate(val, "WriteBackTimer", &b.WriteBackTimer) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", b, err) @@ -298,7 +306,7 @@ func (b *BlobNfsTarget) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Cache. func (c Cache) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", c.ID) populate(objectMap, "identity", c.Identity) populate(objectMap, "location", c.Location) @@ -357,7 +365,7 @@ func (c *Cache) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CacheActiveDirectorySettings. func (c CacheActiveDirectorySettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "cacheNetBiosName", c.CacheNetBiosName) populate(objectMap, "credentials", c.Credentials) populate(objectMap, "domainJoined", c.DomainJoined) @@ -408,7 +416,7 @@ func (c *CacheActiveDirectorySettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CacheActiveDirectorySettingsCredentials. func (c CacheActiveDirectorySettingsCredentials) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "password", c.Password) populate(objectMap, "username", c.Username) return json.Marshal(objectMap) @@ -439,7 +447,7 @@ func (c *CacheActiveDirectorySettingsCredentials) UnmarshalJSON(data []byte) err // MarshalJSON implements the json.Marshaller interface for type CacheDirectorySettings. func (c CacheDirectorySettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "activeDirectory", c.ActiveDirectory) populate(objectMap, "usernameDownload", c.UsernameDownload) return json.Marshal(objectMap) @@ -470,7 +478,7 @@ func (c *CacheDirectorySettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CacheEncryptionSettings. func (c CacheEncryptionSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "keyEncryptionKey", c.KeyEncryptionKey) populate(objectMap, "rotationToLatestKeyVersionEnabled", c.RotationToLatestKeyVersionEnabled) return json.Marshal(objectMap) @@ -501,7 +509,7 @@ func (c *CacheEncryptionSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CacheHealth. func (c CacheHealth) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "conditions", c.Conditions) populate(objectMap, "state", c.State) populate(objectMap, "statusDescription", c.StatusDescription) @@ -536,7 +544,7 @@ func (c *CacheHealth) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CacheIdentity. func (c CacheIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "principalId", c.PrincipalID) populate(objectMap, "tenantId", c.TenantID) populate(objectMap, "type", c.Type) @@ -575,7 +583,7 @@ func (c *CacheIdentity) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CacheNetworkSettings. func (c CacheNetworkSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dnsSearchDomain", c.DNSSearchDomain) populate(objectMap, "dnsServers", c.DNSServers) populate(objectMap, "mtu", c.Mtu) @@ -618,7 +626,7 @@ func (c *CacheNetworkSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CacheProperties. func (c CacheProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "cacheSizeGB", c.CacheSizeGB) populate(objectMap, "directoryServicesSettings", c.DirectoryServicesSettings) populate(objectMap, "encryptionSettings", c.EncryptionSettings) @@ -697,7 +705,7 @@ func (c *CacheProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CacheSKU. func (c CacheSKU) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", c.Name) return json.Marshal(objectMap) } @@ -724,7 +732,7 @@ func (c *CacheSKU) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CacheSecuritySettings. func (c CacheSecuritySettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "accessPolicies", c.AccessPolicies) return json.Marshal(objectMap) } @@ -751,7 +759,7 @@ func (c *CacheSecuritySettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CacheUpgradeSettings. func (c CacheUpgradeSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "scheduledTime", c.ScheduledTime) populate(objectMap, "upgradeScheduleEnabled", c.UpgradeScheduleEnabled) return json.Marshal(objectMap) @@ -782,7 +790,7 @@ func (c *CacheUpgradeSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CacheUpgradeStatus. func (c CacheUpgradeStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "currentFirmwareVersion", c.CurrentFirmwareVersion) populateTimeRFC3339(objectMap, "firmwareUpdateDeadline", c.FirmwareUpdateDeadline) populate(objectMap, "firmwareUpdateStatus", c.FirmwareUpdateStatus) @@ -825,7 +833,7 @@ func (c *CacheUpgradeStatus) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CacheUsernameDownloadSettings. func (c CacheUsernameDownloadSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "autoDownloadCertificate", c.AutoDownloadCertificate) populate(objectMap, "caCertificateURI", c.CaCertificateURI) populate(objectMap, "credentials", c.Credentials) @@ -896,7 +904,7 @@ func (c *CacheUsernameDownloadSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CacheUsernameDownloadSettingsCredentials. func (c CacheUsernameDownloadSettingsCredentials) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "bindDn", c.BindDn) populate(objectMap, "bindPassword", c.BindPassword) return json.Marshal(objectMap) @@ -927,7 +935,7 @@ func (c *CacheUsernameDownloadSettingsCredentials) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type CachesListResult. func (c CachesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", c.NextLink) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) @@ -958,7 +966,7 @@ func (c *CachesListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ClfsTarget. func (c ClfsTarget) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "target", c.Target) return json.Marshal(objectMap) } @@ -983,36 +991,9 @@ func (c *ClfsTarget) 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{}) + objectMap := make(map[string]any) populate(objectMap, "code", c.Code) populate(objectMap, "details", c.Details) populate(objectMap, "message", c.Message) @@ -1051,7 +1032,7 @@ func (c *CloudErrorBody) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Condition. func (c Condition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "message", c.Message) populateTimeRFC3339(objectMap, "timestamp", c.Timestamp) return json.Marshal(objectMap) @@ -1082,7 +1063,7 @@ func (c *Condition) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorResponse. func (e ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "code", e.Code) populate(objectMap, "message", e.Message) return json.Marshal(objectMap) @@ -1113,7 +1094,7 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type KeyVaultKeyReference. func (k KeyVaultKeyReference) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "keyUrl", k.KeyURL) populate(objectMap, "sourceVault", k.SourceVault) return json.Marshal(objectMap) @@ -1144,7 +1125,7 @@ func (k *KeyVaultKeyReference) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type KeyVaultKeyReferenceSourceVault. func (k KeyVaultKeyReferenceSourceVault) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", k.ID) return json.Marshal(objectMap) } @@ -1171,7 +1152,7 @@ func (k *KeyVaultKeyReferenceSourceVault) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogSpecification. func (l LogSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "displayName", l.DisplayName) populate(objectMap, "name", l.Name) return json.Marshal(objectMap) @@ -1202,7 +1183,7 @@ func (l *LogSpecification) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricDimension. func (m MetricDimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "displayName", m.DisplayName) populate(objectMap, "internalName", m.InternalName) populate(objectMap, "name", m.Name) @@ -1241,7 +1222,7 @@ func (m *MetricDimension) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricSpecification. func (m MetricSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "aggregationType", m.AggregationType) populate(objectMap, "dimensions", m.Dimensions) populate(objectMap, "displayDescription", m.DisplayDescription) @@ -1296,7 +1277,7 @@ func (m *MetricSpecification) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NamespaceJunction. func (n NamespaceJunction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "namespacePath", n.NamespacePath) populate(objectMap, "nfsAccessPolicy", n.NfsAccessPolicy) populate(objectMap, "nfsExport", n.NfsExport) @@ -1335,9 +1316,11 @@ func (n *NamespaceJunction) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Nfs3Target. func (n Nfs3Target) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "target", n.Target) populate(objectMap, "usageModel", n.UsageModel) + populate(objectMap, "verificationTimer", n.VerificationTimer) + populate(objectMap, "writeBackTimer", n.WriteBackTimer) return json.Marshal(objectMap) } @@ -1356,6 +1339,12 @@ func (n *Nfs3Target) UnmarshalJSON(data []byte) error { case "usageModel": err = unpopulate(val, "UsageModel", &n.UsageModel) delete(rawMsg, key) + case "verificationTimer": + err = unpopulate(val, "VerificationTimer", &n.VerificationTimer) + delete(rawMsg, key) + case "writeBackTimer": + err = unpopulate(val, "WriteBackTimer", &n.WriteBackTimer) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", n, err) @@ -1366,7 +1355,7 @@ func (n *Nfs3Target) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NfsAccessPolicy. func (n NfsAccessPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "accessRules", n.AccessRules) populate(objectMap, "name", n.Name) return json.Marshal(objectMap) @@ -1397,7 +1386,7 @@ func (n *NfsAccessPolicy) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NfsAccessRule. func (n NfsAccessRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "access", n.Access) populate(objectMap, "anonymousGID", n.AnonymousGID) populate(objectMap, "anonymousUID", n.AnonymousUID) @@ -1452,7 +1441,7 @@ func (n *NfsAccessRule) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrimingJob. func (p PrimingJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "primingJobDetails", p.PrimingJobDetails) populate(objectMap, "primingJobId", p.PrimingJobID) populate(objectMap, "primingJobName", p.PrimingJobName) @@ -1503,7 +1492,7 @@ func (p *PrimingJob) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrimingJobIDParameter. func (p PrimingJobIDParameter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "primingJobId", p.PrimingJobID) return json.Marshal(objectMap) } @@ -1530,7 +1519,7 @@ func (p *PrimingJobIDParameter) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceSKU. func (r ResourceSKU) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "capabilities", r.Capabilities) populate(objectMap, "locationInfo", r.LocationInfo) populate(objectMap, "locations", r.Locations) @@ -1577,7 +1566,7 @@ func (r *ResourceSKU) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceSKUCapabilities. func (r ResourceSKUCapabilities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", r.Name) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) @@ -1608,7 +1597,7 @@ func (r *ResourceSKUCapabilities) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceSKULocationInfo. func (r ResourceSKULocationInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "location", r.Location) populate(objectMap, "zones", r.Zones) return json.Marshal(objectMap) @@ -1639,7 +1628,7 @@ func (r *ResourceSKULocationInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceSKUsResult. func (r ResourceSKUsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", r.NextLink) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) @@ -1670,7 +1659,7 @@ func (r *ResourceSKUsResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceUsage. func (r ResourceUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "currentValue", r.CurrentValue) populate(objectMap, "limit", r.Limit) populate(objectMap, "name", r.Name) @@ -1709,7 +1698,7 @@ func (r *ResourceUsage) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceUsageName. func (r ResourceUsageName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "localizedValue", r.LocalizedValue) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) @@ -1740,7 +1729,7 @@ func (r *ResourceUsageName) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceUsagesListResult. func (r ResourceUsagesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", r.NextLink) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) @@ -1771,7 +1760,7 @@ func (r *ResourceUsagesListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Restriction. func (r Restriction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "reasonCode", r.ReasonCode) populate(objectMap, "type", r.Type) populate(objectMap, "values", r.Values) @@ -1806,7 +1795,7 @@ func (r *Restriction) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type StorageTarget. func (s StorageTarget) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) @@ -1853,7 +1842,7 @@ func (s *StorageTarget) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type StorageTargetProperties. func (s StorageTargetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allocationPercentage", s.AllocationPercentage) populate(objectMap, "blobNfs", s.BlobNfs) populate(objectMap, "clfs", s.Clfs) @@ -1912,7 +1901,7 @@ func (s *StorageTargetProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type StorageTargetResource. func (s StorageTargetResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) @@ -1955,7 +1944,7 @@ func (s *StorageTargetResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type StorageTargetSpaceAllocation. func (s StorageTargetSpaceAllocation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allocationPercentage", s.AllocationPercentage) populate(objectMap, "name", s.Name) return json.Marshal(objectMap) @@ -1986,7 +1975,7 @@ func (s *StorageTargetSpaceAllocation) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type StorageTargetsResult. func (s StorageTargetsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) @@ -2017,7 +2006,7 @@ func (s *StorageTargetsResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) @@ -2064,7 +2053,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UnknownTarget. func (u UnknownTarget) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "attributes", u.Attributes) return json.Marshal(objectMap) } @@ -2091,7 +2080,7 @@ func (u *UnknownTarget) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UsageModel. func (u UsageModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "display", u.Display) populate(objectMap, "modelName", u.ModelName) populate(objectMap, "targetType", u.TargetType) @@ -2126,7 +2115,7 @@ func (u *UsageModel) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UsageModelDisplay. func (u UsageModelDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "description", u.Description) return json.Marshal(objectMap) } @@ -2153,7 +2142,7 @@ func (u *UsageModelDisplay) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UsageModelsResult. func (u UsageModelsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", u.NextLink) populate(objectMap, "value", u.Value) return json.Marshal(objectMap) @@ -2184,7 +2173,7 @@ func (u *UsageModelsResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentitiesValue. func (u UserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "clientId", u.ClientID) populate(objectMap, "principalId", u.PrincipalID) return json.Marshal(objectMap) @@ -2213,7 +2202,7 @@ func (u *UserAssignedIdentitiesValue) UnmarshalJSON(data []byte) error { return nil } -func populate(m map[string]interface{}, k string, v interface{}) { +func populate(m map[string]any, k string, v any) { if v == nil { return } else if azcore.IsNullValue(v) { @@ -2223,7 +2212,7 @@ func populate(m map[string]interface{}, k string, v interface{}) { } } -func unpopulate(data json.RawMessage, fn string, v interface{}) error { +func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil } diff --git a/sdk/resourcemanager/storagecache/armstoragecache/operations_client.go b/sdk/resourcemanager/storagecache/armstoragecache/operations_client.go index 489b4abf650c..80ec3a631226 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/operations_client.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/operations_client.go @@ -28,8 +28,8 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -50,9 +50,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all of the available Resource Provider operations. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// +// Generated from API version 2023-01-01 +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ More: func(page OperationsClientListResponse) bool { @@ -89,7 +89,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", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storagecache/armstoragecache/operations_client_example_test.go b/sdk/resourcemanager/storagecache/armstoragecache/operations_client_example_test.go deleted file mode 100644 index 2354a6743c96..000000000000 --- a/sdk/resourcemanager/storagecache/armstoragecache/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 armstoragecache_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagecache/armstoragecache/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Operations_List.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 := armstoragecache.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/storagecache/armstoragecache/response_types.go b/sdk/resourcemanager/storagecache/armstoragecache/response_types.go index 72d77073ad11..526991d96999 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/response_types.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/response_types.go @@ -14,27 +14,27 @@ type AscOperationsClientGetResponse struct { AscOperation } -// AscUsagesClientListResponse contains the response from method AscUsagesClient.List. +// AscUsagesClientListResponse contains the response from method AscUsagesClient.NewListPager. type AscUsagesClientListResponse struct { ResourceUsagesListResult } -// CachesClientCreateOrUpdateResponse contains the response from method CachesClient.CreateOrUpdate. +// CachesClientCreateOrUpdateResponse contains the response from method CachesClient.BeginCreateOrUpdate. type CachesClientCreateOrUpdateResponse struct { Cache } -// CachesClientDebugInfoResponse contains the response from method CachesClient.DebugInfo. +// CachesClientDebugInfoResponse contains the response from method CachesClient.BeginDebugInfo. type CachesClientDebugInfoResponse struct { // placeholder for future response values } -// CachesClientDeleteResponse contains the response from method CachesClient.Delete. +// CachesClientDeleteResponse contains the response from method CachesClient.BeginDelete. type CachesClientDeleteResponse struct { // placeholder for future response values } -// CachesClientFlushResponse contains the response from method CachesClient.Flush. +// CachesClientFlushResponse contains the response from method CachesClient.BeginFlush. type CachesClientFlushResponse struct { // placeholder for future response values } @@ -44,102 +44,102 @@ type CachesClientGetResponse struct { Cache } -// CachesClientListByResourceGroupResponse contains the response from method CachesClient.ListByResourceGroup. +// CachesClientListByResourceGroupResponse contains the response from method CachesClient.NewListByResourceGroupPager. type CachesClientListByResourceGroupResponse struct { CachesListResult } -// CachesClientListResponse contains the response from method CachesClient.List. +// CachesClientListResponse contains the response from method CachesClient.NewListPager. type CachesClientListResponse struct { CachesListResult } -// CachesClientPausePrimingJobResponse contains the response from method CachesClient.PausePrimingJob. +// CachesClientPausePrimingJobResponse contains the response from method CachesClient.BeginPausePrimingJob. type CachesClientPausePrimingJobResponse struct { // placeholder for future response values } -// CachesClientResumePrimingJobResponse contains the response from method CachesClient.ResumePrimingJob. +// CachesClientResumePrimingJobResponse contains the response from method CachesClient.BeginResumePrimingJob. type CachesClientResumePrimingJobResponse struct { // placeholder for future response values } -// CachesClientSpaceAllocationResponse contains the response from method CachesClient.SpaceAllocation. +// CachesClientSpaceAllocationResponse contains the response from method CachesClient.BeginSpaceAllocation. type CachesClientSpaceAllocationResponse struct { // placeholder for future response values } -// CachesClientStartPrimingJobResponse contains the response from method CachesClient.StartPrimingJob. +// CachesClientStartPrimingJobResponse contains the response from method CachesClient.BeginStartPrimingJob. type CachesClientStartPrimingJobResponse struct { // placeholder for future response values } -// CachesClientStartResponse contains the response from method CachesClient.Start. +// CachesClientStartResponse contains the response from method CachesClient.BeginStart. type CachesClientStartResponse struct { // placeholder for future response values } -// CachesClientStopPrimingJobResponse contains the response from method CachesClient.StopPrimingJob. +// CachesClientStopPrimingJobResponse contains the response from method CachesClient.BeginStopPrimingJob. type CachesClientStopPrimingJobResponse struct { // placeholder for future response values } -// CachesClientStopResponse contains the response from method CachesClient.Stop. +// CachesClientStopResponse contains the response from method CachesClient.BeginStop. type CachesClientStopResponse struct { // placeholder for future response values } -// CachesClientUpdateResponse contains the response from method CachesClient.Update. +// CachesClientUpdateResponse contains the response from method CachesClient.BeginUpdate. type CachesClientUpdateResponse struct { Cache } -// CachesClientUpgradeFirmwareResponse contains the response from method CachesClient.UpgradeFirmware. +// CachesClientUpgradeFirmwareResponse contains the response from method CachesClient.BeginUpgradeFirmware. type CachesClientUpgradeFirmwareResponse struct { // placeholder for future response values } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { APIOperationListResult } -// SKUsClientListResponse contains the response from method SKUsClient.List. +// SKUsClientListResponse contains the response from method SKUsClient.NewListPager. type SKUsClientListResponse struct { ResourceSKUsResult } -// StorageTargetClientFlushResponse contains the response from method StorageTargetClient.Flush. +// StorageTargetClientFlushResponse contains the response from method StorageTargetClient.BeginFlush. type StorageTargetClientFlushResponse struct { // placeholder for future response values } -// StorageTargetClientInvalidateResponse contains the response from method StorageTargetClient.Invalidate. +// StorageTargetClientInvalidateResponse contains the response from method StorageTargetClient.BeginInvalidate. type StorageTargetClientInvalidateResponse struct { // placeholder for future response values } -// StorageTargetClientResumeResponse contains the response from method StorageTargetClient.Resume. +// StorageTargetClientResumeResponse contains the response from method StorageTargetClient.BeginResume. type StorageTargetClientResumeResponse struct { // placeholder for future response values } -// StorageTargetClientSuspendResponse contains the response from method StorageTargetClient.Suspend. +// StorageTargetClientSuspendResponse contains the response from method StorageTargetClient.BeginSuspend. type StorageTargetClientSuspendResponse struct { // placeholder for future response values } -// StorageTargetsClientCreateOrUpdateResponse contains the response from method StorageTargetsClient.CreateOrUpdate. +// StorageTargetsClientCreateOrUpdateResponse contains the response from method StorageTargetsClient.BeginCreateOrUpdate. type StorageTargetsClientCreateOrUpdateResponse struct { StorageTarget } -// StorageTargetsClientDNSRefreshResponse contains the response from method StorageTargetsClient.DNSRefresh. +// StorageTargetsClientDNSRefreshResponse contains the response from method StorageTargetsClient.BeginDNSRefresh. type StorageTargetsClientDNSRefreshResponse struct { // placeholder for future response values } -// StorageTargetsClientDeleteResponse contains the response from method StorageTargetsClient.Delete. +// StorageTargetsClientDeleteResponse contains the response from method StorageTargetsClient.BeginDelete. type StorageTargetsClientDeleteResponse struct { // placeholder for future response values } @@ -149,12 +149,17 @@ type StorageTargetsClientGetResponse struct { StorageTarget } -// StorageTargetsClientListByCacheResponse contains the response from method StorageTargetsClient.ListByCache. +// StorageTargetsClientListByCacheResponse contains the response from method StorageTargetsClient.NewListByCachePager. type StorageTargetsClientListByCacheResponse struct { StorageTargetsResult } -// UsageModelsClientListResponse contains the response from method UsageModelsClient.List. +// StorageTargetsClientRestoreDefaultsResponse contains the response from method StorageTargetsClient.BeginRestoreDefaults. +type StorageTargetsClientRestoreDefaultsResponse struct { + // placeholder for future response values +} + +// UsageModelsClientListResponse contains the response from method UsageModelsClient.NewListPager. type UsageModelsClientListResponse struct { UsageModelsResult } diff --git a/sdk/resourcemanager/storagecache/armstoragecache/skus_client.go b/sdk/resourcemanager/storagecache/armstoragecache/skus_client.go index eed4e85bf154..c5696adecce4 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/skus_client.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/skus_client.go @@ -32,10 +32,10 @@ type SKUsClient struct { } // NewSKUsClient creates a new instance of SKUsClient with the specified values. -// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SKUsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,9 +57,9 @@ func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, opt } // NewListPager - Get the list of StorageCache.Cache SKUs available to this subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// options - SKUsClientListOptions contains the optional parameters for the SKUsClient.List method. +// +// Generated from API version 2023-01-01 +// - options - SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. func (client *SKUsClient) NewListPager(options *SKUsClientListOptions) *runtime.Pager[SKUsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SKUsClientListResponse]{ More: func(page SKUsClientListResponse) bool { @@ -100,7 +100,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", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storagecache/armstoragecache/skus_client_example_test.go b/sdk/resourcemanager/storagecache/armstoragecache/skus_client_example_test.go deleted file mode 100644 index ea725e31328f..000000000000 --- a/sdk/resourcemanager/storagecache/armstoragecache/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 armstoragecache_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagecache/armstoragecache/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/Skus_List.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 := armstoragecache.NewSKUsClient("00000000-0000-0000-0000-000000000000", 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/storagecache/armstoragecache/storagetarget_client.go b/sdk/resourcemanager/storagecache/armstoragecache/storagetarget_client.go index 921be9eea660..6e52db175789 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/storagetarget_client.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/storagetarget_client.go @@ -32,10 +32,10 @@ type StorageTargetClient struct { } // NewStorageTargetClient creates a new instance of StorageTargetClient with the specified values. -// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewStorageTargetClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*StorageTargetClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -59,12 +59,13 @@ func NewStorageTargetClient(subscriptionID string, credential azcore.TokenCreden // BeginFlush - Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage // target's namespace will return errors until the flush operation completes. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// storageTargetName - Name of Storage Target. -// options - StorageTargetClientBeginFlushOptions contains the optional parameters for the StorageTargetClient.BeginFlush -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - storageTargetName - Name of Storage Target. +// - options - StorageTargetClientBeginFlushOptions contains the optional parameters for the StorageTargetClient.BeginFlush +// method. func (client *StorageTargetClient) BeginFlush(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetClientBeginFlushOptions) (*runtime.Poller[StorageTargetClientFlushResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.flush(ctx, resourceGroupName, cacheName, storageTargetName, options) @@ -82,7 +83,8 @@ func (client *StorageTargetClient) BeginFlush(ctx context.Context, resourceGroup // Flush - Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage // target's namespace will return errors until the flush operation completes. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *StorageTargetClient) flush(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetClientBeginFlushOptions) (*http.Response, error) { req, err := client.flushCreateRequest(ctx, resourceGroupName, cacheName, storageTargetName, options) if err != nil { @@ -122,7 +124,7 @@ func (client *StorageTargetClient) flushCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -131,12 +133,13 @@ func (client *StorageTargetClient) flushCreateRequest(ctx context.Context, resou // BeginInvalidate - Invalidate all cached data for a storage target. Cached files are discarded and fetched from the back // end on the next request. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// storageTargetName - Name of Storage Target. -// options - StorageTargetClientBeginInvalidateOptions contains the optional parameters for the StorageTargetClient.BeginInvalidate -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - storageTargetName - Name of Storage Target. +// - options - StorageTargetClientBeginInvalidateOptions contains the optional parameters for the StorageTargetClient.BeginInvalidate +// method. func (client *StorageTargetClient) BeginInvalidate(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetClientBeginInvalidateOptions) (*runtime.Poller[StorageTargetClientInvalidateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.invalidate(ctx, resourceGroupName, cacheName, storageTargetName, options) @@ -154,7 +157,8 @@ func (client *StorageTargetClient) BeginInvalidate(ctx context.Context, resource // Invalidate - Invalidate all cached data for a storage target. Cached files are discarded and fetched from the back end // on the next request. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *StorageTargetClient) invalidate(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetClientBeginInvalidateOptions) (*http.Response, error) { req, err := client.invalidateCreateRequest(ctx, resourceGroupName, cacheName, storageTargetName, options) if err != nil { @@ -194,7 +198,7 @@ func (client *StorageTargetClient) invalidateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,12 +206,13 @@ func (client *StorageTargetClient) invalidateCreateRequest(ctx context.Context, // BeginResume - Resumes client access to a previously suspended storage target. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// storageTargetName - Name of Storage Target. -// options - StorageTargetClientBeginResumeOptions contains the optional parameters for the StorageTargetClient.BeginResume -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - storageTargetName - Name of Storage Target. +// - options - StorageTargetClientBeginResumeOptions contains the optional parameters for the StorageTargetClient.BeginResume +// method. func (client *StorageTargetClient) BeginResume(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetClientBeginResumeOptions) (*runtime.Poller[StorageTargetClientResumeResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.resume(ctx, resourceGroupName, cacheName, storageTargetName, options) @@ -224,7 +229,8 @@ func (client *StorageTargetClient) BeginResume(ctx context.Context, resourceGrou // Resume - Resumes client access to a previously suspended storage target. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *StorageTargetClient) resume(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetClientBeginResumeOptions) (*http.Response, error) { req, err := client.resumeCreateRequest(ctx, resourceGroupName, cacheName, storageTargetName, options) if err != nil { @@ -264,7 +270,7 @@ func (client *StorageTargetClient) resumeCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -272,12 +278,13 @@ func (client *StorageTargetClient) resumeCreateRequest(ctx context.Context, reso // BeginSuspend - Suspends client access to a storage target. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// storageTargetName - Name of Storage Target. -// options - StorageTargetClientBeginSuspendOptions contains the optional parameters for the StorageTargetClient.BeginSuspend -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - storageTargetName - Name of Storage Target. +// - options - StorageTargetClientBeginSuspendOptions contains the optional parameters for the StorageTargetClient.BeginSuspend +// method. func (client *StorageTargetClient) BeginSuspend(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetClientBeginSuspendOptions) (*runtime.Poller[StorageTargetClientSuspendResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.suspend(ctx, resourceGroupName, cacheName, storageTargetName, options) @@ -294,7 +301,8 @@ func (client *StorageTargetClient) BeginSuspend(ctx context.Context, resourceGro // Suspend - Suspends client access to a storage target. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *StorageTargetClient) suspend(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetClientBeginSuspendOptions) (*http.Response, error) { req, err := client.suspendCreateRequest(ctx, resourceGroupName, cacheName, storageTargetName, options) if err != nil { @@ -334,7 +342,7 @@ func (client *StorageTargetClient) suspendCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storagecache/armstoragecache/storagetarget_client_example_test.go b/sdk/resourcemanager/storagecache/armstoragecache/storagetarget_client_example_test.go deleted file mode 100644 index 3a75be600b40..000000000000 --- a/sdk/resourcemanager/storagecache/armstoragecache/storagetarget_client_example_test.go +++ /dev/null @@ -1,117 +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 armstoragecache_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagecache/armstoragecache/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_Flush.json -func ExampleStorageTargetClient_BeginFlush() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewStorageTargetClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginFlush(ctx, - "scgroup", - "sc", - "st1", - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_Suspend.json -func ExampleStorageTargetClient_BeginSuspend() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewStorageTargetClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginSuspend(ctx, - "scgroup", - "sc", - "st1", - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_Resume.json -func ExampleStorageTargetClient_BeginResume() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewStorageTargetClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginResume(ctx, - "scgroup", - "sc", - "st1", - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_Invalidate.json -func ExampleStorageTargetClient_BeginInvalidate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewStorageTargetClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginInvalidate(ctx, - "scgroup", - "sc", - "st1", - 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/storagecache/armstoragecache/storagetargets_client.go b/sdk/resourcemanager/storagecache/armstoragecache/storagetargets_client.go index 65c18c19b91b..963bc9039b8b 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/storagetargets_client.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/storagetargets_client.go @@ -32,10 +32,10 @@ type StorageTargetsClient struct { } // NewStorageTargetsClient creates a new instance of StorageTargetsClient with the specified values. -// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewStorageTargetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*StorageTargetsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -60,13 +60,14 @@ func NewStorageTargetsClient(subscriptionID string, credential azcore.TokenCrede // or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache // is healthy again. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// storageTargetName - Name of Storage Target. -// storagetarget - Object containing the definition of a Storage Target. -// options - StorageTargetsClientBeginCreateOrUpdateOptions contains the optional parameters for the StorageTargetsClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - storageTargetName - Name of Storage Target. +// - storagetarget - Object containing the definition of a Storage Target. +// - options - StorageTargetsClientBeginCreateOrUpdateOptions contains the optional parameters for the StorageTargetsClient.BeginCreateOrUpdate +// method. func (client *StorageTargetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, storagetarget StorageTarget, options *StorageTargetsClientBeginCreateOrUpdateOptions) (*runtime.Poller[StorageTargetsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, cacheName, storageTargetName, storagetarget, options) @@ -83,7 +84,8 @@ func (client *StorageTargetsClient) BeginCreateOrUpdate(ctx context.Context, res // unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache // is healthy again. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *StorageTargetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, storagetarget StorageTarget, options *StorageTargetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, cacheName, storageTargetName, storagetarget, options) if err != nil { @@ -123,7 +125,7 @@ func (client *StorageTargetsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, storagetarget) @@ -131,12 +133,13 @@ func (client *StorageTargetsClient) createOrUpdateCreateRequest(ctx context.Cont // BeginDNSRefresh - Tells a storage target to refresh its DNS information. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// storageTargetName - Name of Storage Target. -// options - StorageTargetsClientBeginDNSRefreshOptions contains the optional parameters for the StorageTargetsClient.BeginDNSRefresh -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - storageTargetName - Name of Storage Target. +// - options - StorageTargetsClientBeginDNSRefreshOptions contains the optional parameters for the StorageTargetsClient.BeginDNSRefresh +// method. func (client *StorageTargetsClient) BeginDNSRefresh(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetsClientBeginDNSRefreshOptions) (*runtime.Poller[StorageTargetsClientDNSRefreshResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.dNSRefresh(ctx, resourceGroupName, cacheName, storageTargetName, options) @@ -153,7 +156,8 @@ func (client *StorageTargetsClient) BeginDNSRefresh(ctx context.Context, resourc // DNSRefresh - Tells a storage target to refresh its DNS information. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *StorageTargetsClient) dNSRefresh(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetsClientBeginDNSRefreshOptions) (*http.Response, error) { req, err := client.dnsRefreshCreateRequest(ctx, resourceGroupName, cacheName, storageTargetName, options) if err != nil { @@ -193,7 +197,7 @@ func (client *StorageTargetsClient) dnsRefreshCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,12 +208,13 @@ func (client *StorageTargetsClient) dnsRefreshCreateRequest(ctx context.Context, // again. Note that if the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target // will be deleted. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// storageTargetName - Name of Storage Target. -// options - StorageTargetsClientBeginDeleteOptions contains the optional parameters for the StorageTargetsClient.BeginDelete -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - storageTargetName - Name of Storage Target. +// - options - StorageTargetsClientBeginDeleteOptions contains the optional parameters for the StorageTargetsClient.BeginDelete +// method. func (client *StorageTargetsClient) BeginDelete(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetsClientBeginDeleteOptions) (*runtime.Poller[StorageTargetsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, cacheName, storageTargetName, options) @@ -227,7 +232,8 @@ func (client *StorageTargetsClient) BeginDelete(ctx context.Context, resourceGro // again. Note that if the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target // will be deleted. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// +// Generated from API version 2023-01-01 func (client *StorageTargetsClient) deleteOperation(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, cacheName, storageTargetName, options) if err != nil { @@ -267,7 +273,7 @@ func (client *StorageTargetsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") if options != nil && options.Force != nil { reqQP.Set("force", *options.Force) } @@ -278,11 +284,12 @@ func (client *StorageTargetsClient) deleteCreateRequest(ctx context.Context, res // Get - Returns a Storage Target from a Cache. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// storageTargetName - Name of Storage Target. -// options - StorageTargetsClientGetOptions contains the optional parameters for the StorageTargetsClient.Get method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - storageTargetName - Name of Storage Target. +// - options - StorageTargetsClientGetOptions contains the optional parameters for the StorageTargetsClient.Get method. func (client *StorageTargetsClient) Get(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetsClientGetOptions) (StorageTargetsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, cacheName, storageTargetName, options) if err != nil { @@ -322,7 +329,7 @@ func (client *StorageTargetsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -338,12 +345,12 @@ func (client *StorageTargetsClient) getHandleResponse(resp *http.Response) (Stor } // NewListByCachePager - Returns a list of Storage Targets for the specified Cache. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// resourceGroupName - Target resource group. -// cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. -// options - StorageTargetsClientListByCacheOptions contains the optional parameters for the StorageTargetsClient.ListByCache -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - options - StorageTargetsClientListByCacheOptions contains the optional parameters for the StorageTargetsClient.NewListByCachePager +// method. func (client *StorageTargetsClient) NewListByCachePager(resourceGroupName string, cacheName string, options *StorageTargetsClientListByCacheOptions) *runtime.Pager[StorageTargetsClientListByCacheResponse] { return runtime.NewPager(runtime.PagingHandler[StorageTargetsClientListByCacheResponse]{ More: func(page StorageTargetsClientListByCacheResponse) bool { @@ -392,7 +399,7 @@ func (client *StorageTargetsClient) listByCacheCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -406,3 +413,75 @@ func (client *StorageTargetsClient) listByCacheHandleResponse(resp *http.Respons } return result, nil } + +// BeginRestoreDefaults - Tells a storage target to restore its settings to their default values. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - Target resource group. +// - cacheName - Name of Cache. Length of name must not be greater than 80 and chars must be from the [-0-9a-zA-Z_] char class. +// - storageTargetName - Name of Storage Target. +// - options - StorageTargetsClientBeginRestoreDefaultsOptions contains the optional parameters for the StorageTargetsClient.BeginRestoreDefaults +// method. +func (client *StorageTargetsClient) BeginRestoreDefaults(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetsClientBeginRestoreDefaultsOptions) (*runtime.Poller[StorageTargetsClientRestoreDefaultsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restoreDefaults(ctx, resourceGroupName, cacheName, storageTargetName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[StorageTargetsClientRestoreDefaultsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[StorageTargetsClientRestoreDefaultsResponse](options.ResumeToken, client.pl, nil) + } +} + +// RestoreDefaults - Tells a storage target to restore its settings to their default values. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +func (client *StorageTargetsClient) restoreDefaults(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetsClientBeginRestoreDefaultsOptions) (*http.Response, error) { + req, err := client.restoreDefaultsCreateRequest(ctx, resourceGroupName, cacheName, storageTargetName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// restoreDefaultsCreateRequest creates the RestoreDefaults request. +func (client *StorageTargetsClient) restoreDefaultsCreateRequest(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetsClientBeginRestoreDefaultsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/restoreDefaults" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if cacheName == "" { + return nil, errors.New("parameter cacheName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{cacheName}", url.PathEscape(cacheName)) + if storageTargetName == "" { + return nil, errors.New("parameter storageTargetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageTargetName}", url.PathEscape(storageTargetName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/storagecache/armstoragecache/storagetargets_client_example_test.go b/sdk/resourcemanager/storagecache/armstoragecache/storagetargets_client_example_test.go deleted file mode 100644 index 2e933908edbf..000000000000 --- a/sdk/resourcemanager/storagecache/armstoragecache/storagetargets_client_example_test.go +++ /dev/null @@ -1,141 +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 armstoragecache_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/storagecache/armstoragecache/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_ListByCache.json -func ExampleStorageTargetsClient_NewListByCachePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewStorageTargetsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByCachePager("scgroup", - "sc1", - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_Delete.json -func ExampleStorageTargetsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewStorageTargetsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "scgroup", - "sc1", - "st1", - &armstoragecache.StorageTargetsClientBeginDeleteOptions{Force: 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_Get.json -func ExampleStorageTargetsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewStorageTargetsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "scgroup", - "sc1", - "st1", - 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/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/StorageTargets_CreateOrUpdate.json -func ExampleStorageTargetsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewStorageTargetsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "scgroup", - "sc1", - "st1", - armstoragecache.StorageTarget{ - Properties: &armstoragecache.StorageTargetProperties{ - Junctions: []*armstoragecache.NamespaceJunction{ - { - NamespacePath: to.Ptr("/path/on/cache"), - NfsAccessPolicy: to.Ptr("default"), - NfsExport: to.Ptr("exp1"), - TargetPath: to.Ptr("/path/on/exp1"), - }, - { - NamespacePath: to.Ptr("/path2/on/cache"), - NfsAccessPolicy: to.Ptr("rootSquash"), - NfsExport: to.Ptr("exp2"), - TargetPath: to.Ptr("/path2/on/exp2"), - }}, - Nfs3: &armstoragecache.Nfs3Target{ - Target: to.Ptr("10.0.44.44"), - UsageModel: to.Ptr("READ_HEAVY_INFREQ"), - }, - TargetType: to.Ptr(armstoragecache.StorageTargetTypeNfs3), - }, - }, - 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 -} diff --git a/sdk/resourcemanager/storagecache/armstoragecache/time_rfc3339.go b/sdk/resourcemanager/storagecache/armstoragecache/time_rfc3339.go index 662f61bdfc02..892055bf7b5f 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/time_rfc3339.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/time_rfc3339.go @@ -62,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/storagecache/armstoragecache/usagemodels_client.go b/sdk/resourcemanager/storagecache/armstoragecache/usagemodels_client.go index 2025f5510e86..db36d4f553ac 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/usagemodels_client.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/usagemodels_client.go @@ -32,10 +32,10 @@ type UsageModelsClient struct { } // NewUsageModelsClient creates a new instance of UsageModelsClient with the specified values. -// subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms +// part of the URI for every service call. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewUsageModelsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsageModelsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,9 +57,9 @@ func NewUsageModelsClient(subscriptionID string, credential azcore.TokenCredenti } // NewListPager - Get the list of Cache Usage Models available to this subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 -// options - UsageModelsClientListOptions contains the optional parameters for the UsageModelsClient.List method. +// +// Generated from API version 2023-01-01 +// - options - UsageModelsClientListOptions contains the optional parameters for the UsageModelsClient.NewListPager method. func (client *UsageModelsClient) NewListPager(options *UsageModelsClientListOptions) *runtime.Pager[UsageModelsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[UsageModelsClientListResponse]{ More: func(page UsageModelsClientListResponse) bool { @@ -100,7 +100,7 @@ func (client *UsageModelsClient) listCreateRequest(ctx context.Context, options return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/storagecache/armstoragecache/usagemodels_client_example_test.go b/sdk/resourcemanager/storagecache/armstoragecache/usagemodels_client_example_test.go deleted file mode 100644 index 0672f0a82a33..000000000000 --- a/sdk/resourcemanager/storagecache/armstoragecache/usagemodels_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 armstoragecache_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storagecache/armstoragecache/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2022-05-01/examples/UsageModels_List.json -func ExampleUsageModelsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armstoragecache.NewUsageModelsClient("00000000-0000-0000-0000-000000000000", 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 - } - } -}