diff --git a/sdk/resourcemanager/storagecache/armstoragecache/CHANGELOG.md b/sdk/resourcemanager/storagecache/armstoragecache/CHANGELOG.md index 8bc5a9ddfbc1..67943b678dfc 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/CHANGELOG.md +++ b/sdk/resourcemanager/storagecache/armstoragecache/CHANGELOG.md @@ -1,5 +1,25 @@ # Release History +## 3.0.0 (2023-01-04) +### Breaking Changes + +- Function `*CachesClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, Cache, *CachesClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, *CachesClientBeginCreateOrUpdateOptions)` +- Function `*StorageTargetsClient.BeginCreateOrUpdate` parameter(s) have been changed from `(context.Context, string, string, string, StorageTarget, *StorageTargetsClientBeginCreateOrUpdateOptions)` to `(context.Context, string, string, string, *StorageTargetsClientBeginCreateOrUpdateOptions)` +- 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 `Cache` in struct `CachesClientBeginCreateOrUpdateOptions` +- New field `VerificationTimer` in struct `Nfs3Target` +- New field `WriteBackTimer` in struct `Nfs3Target` +- New field `Storagetarget` in struct `StorageTargetsClientBeginCreateOrUpdateOptions` + + ## 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..4a7b81f30bd0 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/ascoperations_client.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/ascoperations_client.go @@ -58,7 +58,7 @@ 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 +// 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. @@ -97,7 +97,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..965a310b0b71 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/ascusages_client.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/ascusages_client.go @@ -57,8 +57,7 @@ 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 +// 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.List method. func (client *AscUsagesClient) NewListPager(location string, options *AscUsagesClientListOptions) *runtime.Pager[AscUsagesClientListResponse] { @@ -105,7 +104,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..79f8a3f4b48a 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/caches_client.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/caches_client.go @@ -58,16 +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 +// 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) { +func (client *CachesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginCreateOrUpdateOptions) (*runtime.Poller[CachesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, cacheName, cache, options) + resp, err := client.createOrUpdate(ctx, resourceGroupName, cacheName, options) if err != nil { return nil, err } @@ -79,9 +77,9 @@ 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 -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) +// Generated from API version 2023-01-01 +func (client *CachesClient) createOrUpdate(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, cacheName, options) if err != nil { return nil, err } @@ -96,7 +94,7 @@ func (client *CachesClient) createOrUpdate(ctx context.Context, resourceGroupNam } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *CachesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cacheName string, cache Cache, options *CachesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *CachesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -115,15 +113,18 @@ 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) + if options != nil && options.Cache != nil { + return req, runtime.MarshalAsJSON(req, *options.Cache) + } + return req, nil } // 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 +// 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. @@ -143,7 +144,7 @@ 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 +180,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,7 +188,7 @@ 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 +// 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. @@ -205,7 +206,7 @@ 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 +242,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,7 +251,7 @@ 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 +// 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. @@ -271,7 +272,7 @@ 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 +308,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,7 +316,7 @@ 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 +// 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. @@ -354,7 +355,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,8 +371,7 @@ 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 +// Generated from API version 2023-01-01 // options - CachesClientListOptions contains the optional parameters for the CachesClient.List method. func (client *CachesClient) NewListPager(options *CachesClientListOptions) *runtime.Pager[CachesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[CachesClientListResponse]{ @@ -413,7 +413,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,8 +429,7 @@ 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 +// Generated from API version 2023-01-01 // resourceGroupName - Target resource group. // options - CachesClientListByResourceGroupOptions contains the optional parameters for the CachesClient.ListByResourceGroup // method. @@ -478,7 +477,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,7 +494,7 @@ 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 +// 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 @@ -516,7 +515,7 @@ 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 +551,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,7 +562,7 @@ 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 +// 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 @@ -584,7 +583,7 @@ 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 +619,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,7 +630,7 @@ 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 +// 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 @@ -652,7 +651,7 @@ 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 +687,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,7 +698,7 @@ 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 +// 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. @@ -719,7 +718,7 @@ 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 +754,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,7 +762,7 @@ 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 +// 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 @@ -784,7 +783,7 @@ 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 +819,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,7 +830,7 @@ 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 +// 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. @@ -851,7 +850,7 @@ 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 +886,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,7 +894,7 @@ 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 +// 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 @@ -916,7 +915,7 @@ 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 +951,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 +960,46 @@ func (client *CachesClient) stopPrimingJobCreateRequest(ctx context.Context, res return req, nil } -// Update - Update a Cache instance. +// BeginUpdate - Update a Cache instance. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01 +// 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 - 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) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, cacheName, cache, options) +// options - CachesClientBeginUpdateOptions contains the optional parameters for the CachesClient.BeginUpdate method. +func (client *CachesClient) BeginUpdate(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginUpdateOptions) (*runtime.Poller[CachesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, cacheName, 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 2023-01-01 +func (client *CachesClient) update(ctx context.Context, resourceGroupName string, cacheName string, options *CachesClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, cacheName, 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, 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,24 +1018,18 @@ 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 + if options != nil && options.Cache != nil { + return req, runtime.MarshalAsJSON(req, *options.Cache) } - return result, nil + return req, 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 +// 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 @@ -1042,7 +1050,7 @@ 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 +1086,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..d3f7969114f6 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/models.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/models.go @@ -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 @@ -389,6 +395,9 @@ type CacheUsernameDownloadSettingsCredentials struct { // CachesClientBeginCreateOrUpdateOptions contains the optional parameters for the CachesClient.BeginCreateOrUpdate method. type CachesClientBeginCreateOrUpdateOptions struct { + // 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. + Cache *Cache // Resumes the LRO from the provided token. ResumeToken string } @@ -463,6 +472,15 @@ type CachesClientBeginStopPrimingJobOptions struct { ResumeToken string } +// CachesClientBeginUpdateOptions contains the optional parameters for the CachesClient.BeginUpdate method. +type CachesClientBeginUpdateOptions struct { + // Object containing the user-selectable properties of the Cache. If read-only properties are included, they must match the + // existing values of those properties. + Cache *Cache + // 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. @@ -484,11 +502,6 @@ 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 +518,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 +639,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. @@ -922,6 +935,8 @@ type StorageTargetSpaceAllocation struct { type StorageTargetsClientBeginCreateOrUpdateOptions struct { // Resumes the LRO from the provided token. ResumeToken string + // Object containing the definition of a Storage Target. + Storagetarget *StorageTarget } // StorageTargetsClientBeginDNSRefreshOptions contains the optional parameters for the StorageTargetsClient.BeginDNSRefresh @@ -940,6 +955,13 @@ 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 diff --git a/sdk/resourcemanager/storagecache/armstoragecache/models_serde.go b/sdk/resourcemanager/storagecache/armstoragecache/models_serde.go index 5c54979d4b2d..4fe96ae72672 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/models_serde.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/models_serde.go @@ -270,6 +270,8 @@ func (b BlobNfsTarget) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) 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) @@ -983,33 +991,6 @@ 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{}) @@ -1338,6 +1319,8 @@ func (n Nfs3Target) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) 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) diff --git a/sdk/resourcemanager/storagecache/armstoragecache/operations_client.go b/sdk/resourcemanager/storagecache/armstoragecache/operations_client.go index 489b4abf650c..5b38de01d5ce 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/operations_client.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/operations_client.go @@ -50,8 +50,7 @@ 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 +// Generated from API version 2023-01-01 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -89,7 +88,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..a2eb3c2be69d 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/response_types.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/response_types.go @@ -154,6 +154,11 @@ type StorageTargetsClientListByCacheResponse struct { StorageTargetsResult } +// StorageTargetsClientRestoreDefaultsResponse contains the response from method StorageTargetsClient.RestoreDefaults. +type StorageTargetsClientRestoreDefaultsResponse struct { + // placeholder for future response values +} + // UsageModelsClientListResponse contains the response from method UsageModelsClient.List. type UsageModelsClientListResponse struct { UsageModelsResult diff --git a/sdk/resourcemanager/storagecache/armstoragecache/skus_client.go b/sdk/resourcemanager/storagecache/armstoragecache/skus_client.go index eed4e85bf154..9cd161fa2f86 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/skus_client.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/skus_client.go @@ -57,8 +57,7 @@ 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 +// Generated from API version 2023-01-01 // options - SKUsClientListOptions contains the optional parameters for the SKUsClient.List method. func (client *SKUsClient) NewListPager(options *SKUsClientListOptions) *runtime.Pager[SKUsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SKUsClientListResponse]{ @@ -100,7 +99,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..4e2f04bf6aa0 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/storagetarget_client.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/storagetarget_client.go @@ -59,7 +59,7 @@ 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 +// 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. @@ -82,7 +82,7 @@ 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 +122,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,7 +131,7 @@ 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 +// 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. @@ -154,7 +154,7 @@ 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 +194,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,7 +202,7 @@ 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 +// 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. @@ -224,7 +224,7 @@ 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 +264,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,7 +272,7 @@ 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 +// 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. @@ -294,7 +294,7 @@ 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 +334,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..cc9f4317957e 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/storagetargets_client.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/storagetargets_client.go @@ -60,16 +60,15 @@ 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 +// 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) { +func (client *StorageTargetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetsClientBeginCreateOrUpdateOptions) (*runtime.Poller[StorageTargetsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, cacheName, storageTargetName, storagetarget, options) + resp, err := client.createOrUpdate(ctx, resourceGroupName, cacheName, storageTargetName, options) if err != nil { return nil, err } @@ -83,9 +82,9 @@ 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 -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) +// Generated from API version 2023-01-01 +func (client *StorageTargetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, cacheName, storageTargetName, options) if err != nil { return nil, err } @@ -100,7 +99,7 @@ func (client *StorageTargetsClient) createOrUpdate(ctx context.Context, resource } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *StorageTargetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, storagetarget StorageTarget, options *StorageTargetsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *StorageTargetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cacheName string, storageTargetName string, options *StorageTargetsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -123,15 +122,18 @@ 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) + if options != nil && options.Storagetarget != nil { + return req, runtime.MarshalAsJSON(req, *options.Storagetarget) + } + return req, nil } // 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 +// 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. @@ -153,7 +155,7 @@ 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 +195,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,7 +206,7 @@ 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 +// 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. @@ -227,7 +229,7 @@ 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 +269,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,7 +280,7 @@ 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 +// 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. @@ -322,7 +324,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,8 +340,7 @@ 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 +// 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.ListByCache @@ -392,7 +393,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 +407,73 @@ 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/usagemodels_client.go b/sdk/resourcemanager/storagecache/armstoragecache/usagemodels_client.go index 2025f5510e86..010ccc9996b4 100644 --- a/sdk/resourcemanager/storagecache/armstoragecache/usagemodels_client.go +++ b/sdk/resourcemanager/storagecache/armstoragecache/usagemodels_client.go @@ -57,8 +57,7 @@ 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 +// Generated from API version 2023-01-01 // options - UsageModelsClientListOptions contains the optional parameters for the UsageModelsClient.List method. func (client *UsageModelsClient) NewListPager(options *UsageModelsClientListOptions) *runtime.Pager[UsageModelsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[UsageModelsClientListResponse]{ @@ -100,7 +99,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 - } - } -}