diff --git a/sdk/resourcemanager/netapp/armnetapp/CHANGELOG.md b/sdk/resourcemanager/netapp/armnetapp/CHANGELOG.md index 69e0400d139f..b049dac57dde 100644 --- a/sdk/resourcemanager/netapp/armnetapp/CHANGELOG.md +++ b/sdk/resourcemanager/netapp/armnetapp/CHANGELOG.md @@ -1,5 +1,70 @@ # Release History +## 6.0.0-beta.1 (2023-12-22) +### Breaking Changes + +- Field `DeploymentSpecID` of struct `VolumeGroupMetaData` has been removed + +### Features Added + +- New enum type `BackupType` with values `BackupTypeManual`, `BackupTypeScheduled` +- New function `NewAccountBackupsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AccountBackupsClient, error)` +- New function `*AccountBackupsClient.BeginDelete(context.Context, string, string, string, *AccountBackupsClientBeginDeleteOptions) (*runtime.Poller[AccountBackupsClientDeleteResponse], error)` +- New function `*AccountBackupsClient.Get(context.Context, string, string, string, *AccountBackupsClientGetOptions) (AccountBackupsClientGetResponse, error)` +- New function `*AccountBackupsClient.NewListByNetAppAccountPager(string, string, *AccountBackupsClientListByNetAppAccountOptions) *runtime.Pager[AccountBackupsClientListByNetAppAccountResponse]` +- New function `*AccountsClient.BeginMigrateEncryptionKey(context.Context, string, string, *AccountsClientBeginMigrateEncryptionKeyOptions) (*runtime.Poller[AccountsClientMigrateEncryptionKeyResponse], error)` +- New function `NewBackupVaultsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BackupVaultsClient, error)` +- New function `*BackupVaultsClient.BeginCreateOrUpdate(context.Context, string, string, string, BackupVault, *BackupVaultsClientBeginCreateOrUpdateOptions) (*runtime.Poller[BackupVaultsClientCreateOrUpdateResponse], error)` +- New function `*BackupVaultsClient.BeginDelete(context.Context, string, string, string, *BackupVaultsClientBeginDeleteOptions) (*runtime.Poller[BackupVaultsClientDeleteResponse], error)` +- New function `*BackupVaultsClient.Get(context.Context, string, string, string, *BackupVaultsClientGetOptions) (BackupVaultsClientGetResponse, error)` +- New function `*BackupVaultsClient.NewListByNetAppAccountPager(string, string, *BackupVaultsClientListByNetAppAccountOptions) *runtime.Pager[BackupVaultsClientListByNetAppAccountResponse]` +- New function `*BackupVaultsClient.BeginUpdate(context.Context, string, string, string, BackupVaultPatch, *BackupVaultsClientBeginUpdateOptions) (*runtime.Poller[BackupVaultsClientUpdateResponse], error)` +- New function `*BackupsClient.BeginCreate(context.Context, string, string, string, string, Backup, *BackupsClientBeginCreateOptions) (*runtime.Poller[BackupsClientCreateResponse], error)` +- New function `*BackupsClient.BeginDelete(context.Context, string, string, string, string, *BackupsClientBeginDeleteOptions) (*runtime.Poller[BackupsClientDeleteResponse], error)` +- New function `*BackupsClient.Get(context.Context, string, string, string, string, *BackupsClientGetOptions) (BackupsClientGetResponse, error)` +- New function `*BackupsClient.GetLatestStatus(context.Context, string, string, string, string, *BackupsClientGetLatestStatusOptions) (BackupsClientGetLatestStatusResponse, error)` +- New function `*BackupsClient.NewListByVaultPager(string, string, string, *BackupsClientListByVaultOptions) *runtime.Pager[BackupsClientListByVaultResponse]` +- New function `*BackupsClient.BeginUpdate(context.Context, string, string, string, string, BackupPatch, *BackupsClientBeginUpdateOptions) (*runtime.Poller[BackupsClientUpdateResponse], error)` +- New function `NewBackupsUnderAccountClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BackupsUnderAccountClient, error)` +- New function `*BackupsUnderAccountClient.BeginMigrateBackups(context.Context, string, string, BackupsMigrationRequest, *BackupsUnderAccountClientBeginMigrateBackupsOptions) (*runtime.Poller[BackupsUnderAccountClientMigrateBackupsResponse], error)` +- New function `NewBackupsUnderBackupVaultClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BackupsUnderBackupVaultClient, error)` +- New function `*BackupsUnderBackupVaultClient.BeginRestoreFiles(context.Context, string, string, string, string, BackupRestoreFiles, *BackupsUnderBackupVaultClientBeginRestoreFilesOptions) (*runtime.Poller[BackupsUnderBackupVaultClientRestoreFilesResponse], error)` +- New function `NewBackupsUnderVolumeClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BackupsUnderVolumeClient, error)` +- New function `*BackupsUnderVolumeClient.BeginMigrateBackups(context.Context, string, string, string, string, BackupsMigrationRequest, *BackupsUnderVolumeClientBeginMigrateBackupsOptions) (*runtime.Poller[BackupsUnderVolumeClientMigrateBackupsResponse], error)` +- New function `*ClientFactory.NewAccountBackupsClient() *AccountBackupsClient` +- New function `*ClientFactory.NewBackupVaultsClient() *BackupVaultsClient` +- New function `*ClientFactory.NewBackupsUnderAccountClient() *BackupsUnderAccountClient` +- New function `*ClientFactory.NewBackupsUnderBackupVaultClient() *BackupsUnderBackupVaultClient` +- New function `*ClientFactory.NewBackupsUnderVolumeClient() *BackupsUnderVolumeClient` +- New function `*ClientFactory.NewResourceRegionInfosClient() *ResourceRegionInfosClient` +- New function `NewResourceRegionInfosClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ResourceRegionInfosClient, error)` +- New function `*ResourceRegionInfosClient.Get(context.Context, string, *ResourceRegionInfosClientGetOptions) (ResourceRegionInfosClientGetResponse, error)` +- New function `*ResourceRegionInfosClient.NewListPager(string, *ResourceRegionInfosClientListOptions) *runtime.Pager[ResourceRegionInfosClientListResponse]` +- New function `*VolumesClient.BeginSplitCloneFromParent(context.Context, string, string, string, string, *VolumesClientBeginSplitCloneFromParentOptions) (*runtime.Poller[VolumesClientSplitCloneFromParentResponse], error)` +- New struct `Backup` +- New struct `BackupPatch` +- New struct `BackupPatchProperties` +- New struct `BackupProperties` +- New struct `BackupRestoreFiles` +- New struct `BackupStatus` +- New struct `BackupVault` +- New struct `BackupVaultPatch` +- New struct `BackupVaultProperties` +- New struct `BackupVaultsList` +- New struct `BackupsList` +- New struct `BackupsMigrationRequest` +- New struct `EncryptionMigrationRequest` +- New struct `RegionInfoResource` +- New struct `RegionInfosList` +- New struct `RemotePath` +- New struct `VolumeBackupProperties` +- New field `IsMultiAdEnabled`, `NfsV4IDDomain` in struct `AccountProperties` +- New field `RemotePath` in struct `ReplicationObject` +- New field `Backup` in struct `VolumePatchPropertiesDataProtection` +- New field `InheritedSizeInBytes` in struct `VolumeProperties` +- New field `Backup` in struct `VolumePropertiesDataProtection` + + ## 5.1.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/netapp/armnetapp/accountbackups_client.go b/sdk/resourcemanager/netapp/armnetapp/accountbackups_client.go new file mode 100644 index 000000000000..d31101b0f5fb --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/accountbackups_client.go @@ -0,0 +1,264 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AccountBackupsClient contains the methods for the AccountBackups group. +// Don't use this type directly, use NewAccountBackupsClient() instead. +type AccountBackupsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAccountBackupsClient creates a new instance of AccountBackupsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAccountBackupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccountBackupsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AccountBackupsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginDelete - Delete the specified Backup for a Netapp Account +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - backupName - The name of the backup +// - options - AccountBackupsClientBeginDeleteOptions contains the optional parameters for the AccountBackupsClient.BeginDelete +// method. +func (client *AccountBackupsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, backupName string, options *AccountBackupsClientBeginDeleteOptions) (*runtime.Poller[AccountBackupsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, backupName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountBackupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AccountBackupsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete the specified Backup for a Netapp Account +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *AccountBackupsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, backupName string, options *AccountBackupsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "AccountBackupsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, backupName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AccountBackupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupName string, options *AccountBackupsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the specified backup for a Netapp Account +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - backupName - The name of the backup +// - options - AccountBackupsClientGetOptions contains the optional parameters for the AccountBackupsClient.Get method. +func (client *AccountBackupsClient) Get(ctx context.Context, resourceGroupName string, accountName string, backupName string, options *AccountBackupsClientGetOptions) (AccountBackupsClientGetResponse, error) { + var err error + const operationName = "AccountBackupsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, backupName, options) + if err != nil { + return AccountBackupsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountBackupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountBackupsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AccountBackupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupName string, options *AccountBackupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AccountBackupsClient) getHandleResponse(resp *http.Response) (AccountBackupsClientGetResponse, error) { + result := AccountBackupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Backup); err != nil { + return AccountBackupsClientGetResponse{}, err + } + return result, nil +} + +// NewListByNetAppAccountPager - List all Backups for a Netapp Account +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - options - AccountBackupsClientListByNetAppAccountOptions contains the optional parameters for the AccountBackupsClient.NewListByNetAppAccountPager +// method. +func (client *AccountBackupsClient) NewListByNetAppAccountPager(resourceGroupName string, accountName string, options *AccountBackupsClientListByNetAppAccountOptions) *runtime.Pager[AccountBackupsClientListByNetAppAccountResponse] { + return runtime.NewPager(runtime.PagingHandler[AccountBackupsClientListByNetAppAccountResponse]{ + More: func(page AccountBackupsClientListByNetAppAccountResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *AccountBackupsClientListByNetAppAccountResponse) (AccountBackupsClientListByNetAppAccountResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AccountBackupsClient.NewListByNetAppAccountPager") + req, err := client.listByNetAppAccountCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return AccountBackupsClientListByNetAppAccountResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AccountBackupsClientListByNetAppAccountResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccountBackupsClientListByNetAppAccountResponse{}, runtime.NewResponseError(resp) + } + return client.listByNetAppAccountHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByNetAppAccountCreateRequest creates the ListByNetAppAccount request. +func (client *AccountBackupsClient) listByNetAppAccountCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountBackupsClientListByNetAppAccountOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + if options != nil && options.IncludeOnlyBackupsFromDeletedVolumes != nil { + reqQP.Set("includeOnlyBackupsFromDeletedVolumes", *options.IncludeOnlyBackupsFromDeletedVolumes) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByNetAppAccountHandleResponse handles the ListByNetAppAccount response. +func (client *AccountBackupsClient) listByNetAppAccountHandleResponse(resp *http.Response) (AccountBackupsClientListByNetAppAccountResponse, error) { + result := AccountBackupsClientListByNetAppAccountResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupsList); err != nil { + return AccountBackupsClientListByNetAppAccountResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/netapp/armnetapp/accountbackups_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/accountbackups_client_example_test.go new file mode 100644 index 000000000000..b3b8bd190e63 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/accountbackups_client_example_test.go @@ -0,0 +1,113 @@ +//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. +// DO NOT EDIT. + +package armnetapp_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Backups_Account_List.json +func ExampleAccountBackupsClient_NewListByNetAppAccountPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAccountBackupsClient().NewListByNetAppAccountPager("myRG", "account1", &armnetapp.AccountBackupsClientListByNetAppAccountOptions{IncludeOnlyBackupsFromDeletedVolumes: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.BackupsList = armnetapp.BackupsList{ + // Value: []*armnetapp.Backup{ + // { + // Name: to.Ptr("account1/backup1"), + // Type: to.Ptr("Microsoft.NetApp/netAppAccounts/accountBackups"), + // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/accountBackups/backup1"), + // Properties: &armnetapp.BackupProperties{ + // BackupType: to.Ptr(armnetapp.BackupTypeManual), + // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-15T13:23:33.000Z"); return t}()), + // Label: to.Ptr("myLabel"), + // ProvisioningState: to.Ptr("Succeeded"), + // Size: to.Ptr[int64](10011), + // VolumeResourceID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPool/pool1/volumes/volume1"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Backups_Account_Get.json +func ExampleAccountBackupsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAccountBackupsClient().Get(ctx, "myRG", "account1", "backup1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Backup = armnetapp.Backup{ + // Name: to.Ptr("account1/backup1"), + // Type: to.Ptr("Microsoft.NetApp/netAppAccounts/accountBackups"), + // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/accountBackups/backup1"), + // Properties: &armnetapp.BackupProperties{ + // BackupType: to.Ptr(armnetapp.BackupTypeManual), + // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-15T13:23:33.000Z"); return t}()), + // Label: to.Ptr("myLabel"), + // ProvisioningState: to.Ptr("Succeeded"), + // Size: to.Ptr[int64](10011), + // VolumeResourceID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPool/pool1/volumes/volume1"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Backups_Account_Delete.json +func ExampleAccountBackupsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAccountBackupsClient().BeginDelete(ctx, "resourceGroup", "accountName", "backupName", 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/netapp/armnetapp/accounts_client.go b/sdk/resourcemanager/netapp/armnetapp/accounts_client.go index 428f124625c6..af030472c681 100644 --- a/sdk/resourcemanager/netapp/armnetapp/accounts_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/accounts_client.go @@ -28,7 +28,7 @@ type AccountsClient struct { } // NewAccountsClient creates a new instance of AccountsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccountsClient, error) { @@ -46,7 +46,7 @@ func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreateOrUpdate - Create or update the specified NetApp account within the resource group // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - body - NetApp Account object supplied in the body of the operation. @@ -73,7 +73,7 @@ func (client *AccountsClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create or update the specified NetApp account within the resource group // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *AccountsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, body Account, options *AccountsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.BeginCreateOrUpdate" @@ -115,7 +115,7 @@ func (client *AccountsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -127,7 +127,7 @@ func (client *AccountsClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Delete the specified NetApp account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - options - AccountsClientBeginDeleteOptions contains the optional parameters for the AccountsClient.BeginDelete method. @@ -152,7 +152,7 @@ func (client *AccountsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete the specified NetApp account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *AccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.BeginDelete" @@ -194,7 +194,7 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -202,7 +202,7 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get the NetApp account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - options - AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. @@ -248,7 +248,7 @@ func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +265,7 @@ func (client *AccountsClient) getHandleResponse(resp *http.Response) (AccountsCl // NewListPager - List and describe all NetApp accounts in the resource group. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AccountsClientListOptions contains the optional parameters for the AccountsClient.NewListPager method. func (client *AccountsClient) NewListPager(resourceGroupName string, options *AccountsClientListOptions) *runtime.Pager[AccountsClientListResponse] { @@ -307,7 +307,7 @@ func (client *AccountsClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -324,7 +324,7 @@ func (client *AccountsClient) listHandleResponse(resp *http.Response) (AccountsC // NewListBySubscriptionPager - List and describe all NetApp accounts in the subscription. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - options - AccountsClientListBySubscriptionOptions contains the optional parameters for the AccountsClient.NewListBySubscriptionPager // method. func (client *AccountsClient) NewListBySubscriptionPager(options *AccountsClientListBySubscriptionOptions) *runtime.Pager[AccountsClientListBySubscriptionResponse] { @@ -362,7 +362,7 @@ func (client *AccountsClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -377,12 +377,99 @@ func (client *AccountsClient) listBySubscriptionHandleResponse(resp *http.Respon return result, nil } +// BeginMigrateEncryptionKey - Migrates all volumes in a VNet to a different encryption key source (Microsoft-managed key +// or Azure Key Vault). Operation fails if targeted volumes share encryption sibling set with volumes from +// another account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - options - AccountsClientBeginMigrateEncryptionKeyOptions contains the optional parameters for the AccountsClient.BeginMigrateEncryptionKey +// method. +func (client *AccountsClient) BeginMigrateEncryptionKey(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginMigrateEncryptionKeyOptions) (*runtime.Poller[AccountsClientMigrateEncryptionKeyResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.migrateEncryptionKey(ctx, resourceGroupName, accountName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountsClientMigrateEncryptionKeyResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AccountsClientMigrateEncryptionKeyResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// MigrateEncryptionKey - Migrates all volumes in a VNet to a different encryption key source (Microsoft-managed key or Azure +// Key Vault). Operation fails if targeted volumes share encryption sibling set with volumes from +// another account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *AccountsClient) migrateEncryptionKey(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginMigrateEncryptionKeyOptions) (*http.Response, error) { + var err error + const operationName = "AccountsClient.BeginMigrateEncryptionKey" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.migrateEncryptionKeyCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// migrateEncryptionKeyCreateRequest creates the MigrateEncryptionKey request. +func (client *AccountsClient) migrateEncryptionKeyCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginMigrateEncryptionKeyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/migrateEncryption" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Body != nil { + if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + // BeginRenewCredentials - Renew identity credentials that are used to authenticate to key vault, for customer-managed key // encryption. If encryption.identity.principalId does not match identity.principalId, running this // operation will fix it. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - options - AccountsClientBeginRenewCredentialsOptions contains the optional parameters for the AccountsClient.BeginRenewCredentials @@ -410,7 +497,7 @@ func (client *AccountsClient) BeginRenewCredentials(ctx context.Context, resourc // operation will fix it. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *AccountsClient) renewCredentials(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginRenewCredentialsOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.BeginRenewCredentials" @@ -452,7 +539,7 @@ func (client *AccountsClient) renewCredentialsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -460,7 +547,7 @@ func (client *AccountsClient) renewCredentialsCreateRequest(ctx context.Context, // BeginUpdate - Patch the specified NetApp account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - body - NetApp Account object supplied in the body of the operation. @@ -486,7 +573,7 @@ func (client *AccountsClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Patch the specified NetApp account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *AccountsClient) update(ctx context.Context, resourceGroupName string, accountName string, body AccountPatch, options *AccountsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "AccountsClient.BeginUpdate" @@ -528,7 +615,7 @@ func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/accounts_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/accounts_client_example_test.go index 64aeaf53b189..a62f7ff04f92 100644 --- a/sdk/resourcemanager/netapp/armnetapp/accounts_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/accounts_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Accounts_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Accounts_List.json func ExampleAccountsClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -55,7 +55,7 @@ func ExampleAccountsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Accounts_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Accounts_Get.json func ExampleAccountsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -98,7 +98,7 @@ func ExampleAccountsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Accounts_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Accounts_CreateOrUpdate.json func ExampleAccountsClient_BeginCreateOrUpdate_accountsCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -134,7 +134,7 @@ func ExampleAccountsClient_BeginCreateOrUpdate_accountsCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Accounts_CreateOrUpdateAD.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Accounts_CreateOrUpdateAD.json func ExampleAccountsClient_BeginCreateOrUpdate_accountsCreateOrUpdateWithActiveDirectory() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -197,7 +197,7 @@ func ExampleAccountsClient_BeginCreateOrUpdate_accountsCreateOrUpdateWithActiveD // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Accounts_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Accounts_Delete.json func ExampleAccountsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -218,7 +218,7 @@ func ExampleAccountsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Accounts_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Accounts_Update.json func ExampleAccountsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -255,7 +255,7 @@ func ExampleAccountsClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Accounts_RenewCredentials.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Accounts_RenewCredentials.json func ExampleAccountsClient_BeginRenewCredentials() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -275,3 +275,28 @@ func ExampleAccountsClient_BeginRenewCredentials() { log.Fatalf("failed to pull the result: %v", err) } } + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Accounts_MigrateEncryptionKey.json +func ExampleAccountsClient_BeginMigrateEncryptionKey() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAccountsClient().BeginMigrateEncryptionKey(ctx, "myRG", "account1", &armnetapp.AccountsClientBeginMigrateEncryptionKeyOptions{Body: &armnetapp.EncryptionMigrationRequest{ + PrivateEndpointID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.Network/privateEndpoints/privip1"), + VirtualNetworkID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.Network/virtualNetworks/vnet1"), + }, + }) + 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/netapp/armnetapp/autorest.md b/sdk/resourcemanager/netapp/armnetapp/autorest.md index 57f18aa5c328..a8c8b335f2d0 100644 --- a/sdk/resourcemanager/netapp/armnetapp/autorest.md +++ b/sdk/resourcemanager/netapp/armnetapp/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 5.1.0 -tag: package-netapp-2023-05-01 +module-version: 6.0.0-beta.1 +tag: package-preview-2023-05 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/netapp/armnetapp/backuppolicies_client.go b/sdk/resourcemanager/netapp/armnetapp/backuppolicies_client.go index 21a0fbde9f22..f56891a7fb9e 100644 --- a/sdk/resourcemanager/netapp/armnetapp/backuppolicies_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/backuppolicies_client.go @@ -28,7 +28,7 @@ type BackupPoliciesClient struct { } // NewBackupPoliciesClient creates a new instance of BackupPoliciesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewBackupPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupPoliciesClient, error) { @@ -46,7 +46,7 @@ func NewBackupPoliciesClient(subscriptionID string, credential azcore.TokenCrede // BeginCreate - Create a backup policy for Netapp Account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - backupPolicyName - Backup policy Name which uniquely identify backup policy. @@ -74,7 +74,7 @@ func (client *BackupPoliciesClient) BeginCreate(ctx context.Context, resourceGro // Create - Create a backup policy for Netapp Account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *BackupPoliciesClient) create(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicy, options *BackupPoliciesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "BackupPoliciesClient.BeginCreate" @@ -120,7 +120,7 @@ func (client *BackupPoliciesClient) createCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -132,7 +132,7 @@ func (client *BackupPoliciesClient) createCreateRequest(ctx context.Context, res // BeginDelete - Delete backup policy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - backupPolicyName - Backup policy Name which uniquely identify backup policy. @@ -159,7 +159,7 @@ func (client *BackupPoliciesClient) BeginDelete(ctx context.Context, resourceGro // Delete - Delete backup policy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *BackupPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, options *BackupPoliciesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "BackupPoliciesClient.BeginDelete" @@ -205,7 +205,7 @@ func (client *BackupPoliciesClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -213,7 +213,7 @@ func (client *BackupPoliciesClient) deleteCreateRequest(ctx context.Context, res // Get - Get a particular backup Policy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - backupPolicyName - Backup policy Name which uniquely identify backup policy. @@ -264,7 +264,7 @@ func (client *BackupPoliciesClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,7 +281,7 @@ func (client *BackupPoliciesClient) getHandleResponse(resp *http.Response) (Back // NewListPager - List backup policies for Netapp Account // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - options - BackupPoliciesClientListOptions contains the optional parameters for the BackupPoliciesClient.NewListPager method. @@ -329,7 +329,7 @@ func (client *BackupPoliciesClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -347,7 +347,7 @@ func (client *BackupPoliciesClient) listHandleResponse(resp *http.Response) (Bac // BeginUpdate - Patch a backup policy for Netapp Account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - backupPolicyName - Backup policy Name which uniquely identify backup policy. @@ -375,7 +375,7 @@ func (client *BackupPoliciesClient) BeginUpdate(ctx context.Context, resourceGro // Update - Patch a backup policy for Netapp Account // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *BackupPoliciesClient) update(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicyPatch, options *BackupPoliciesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "BackupPoliciesClient.BeginUpdate" @@ -421,7 +421,7 @@ func (client *BackupPoliciesClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/backuppolicies_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/backuppolicies_client_example_test.go index 201d44f02202..9808a03c5e70 100644 --- a/sdk/resourcemanager/netapp/armnetapp/backuppolicies_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/backuppolicies_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/BackupPolicies_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupPolicies_List.json func ExampleBackupPoliciesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -45,7 +45,7 @@ func ExampleBackupPoliciesClient_NewListPager() { // { // Name: to.Ptr("account1/backupPolicy1"), // Type: to.Ptr("Microsoft.NetApp/netAppAccounts/backupPolicies"), - // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupPolocies/backupPolicy1"), + // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupPolicies/backupPolicy1"), // Location: to.Ptr("eastus"), // Properties: &armnetapp.BackupPolicyProperties{ // DailyBackupsToKeep: to.Ptr[int32](10), @@ -59,7 +59,7 @@ func ExampleBackupPoliciesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/BackupPolicies_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupPolicies_Get.json func ExampleBackupPoliciesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -80,7 +80,7 @@ func ExampleBackupPoliciesClient_Get() { // res.BackupPolicy = armnetapp.BackupPolicy{ // Name: to.Ptr("account1/backupPolicyName"), // Type: to.Ptr("Microsoft.NetApp/netAppAccounts/backupPolicies"), - // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupPolocies/backupPolicyName"), + // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupPolicies/backupPolicyName"), // Location: to.Ptr("eastus"), // Properties: &armnetapp.BackupPolicyProperties{ // DailyBackupsToKeep: to.Ptr[int32](10), @@ -98,7 +98,7 @@ func ExampleBackupPoliciesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/BackupPolicies_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupPolicies_Create.json func ExampleBackupPoliciesClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -131,7 +131,7 @@ func ExampleBackupPoliciesClient_BeginCreate() { // res.BackupPolicy = armnetapp.BackupPolicy{ // Name: to.Ptr("account1/backupPolicyName"), // Type: to.Ptr("Microsoft.NetApp/netAppAccounts/backupPolicies"), - // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupPolocies/backupPolicyName"), + // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupPolicies/backupPolicyName"), // Location: to.Ptr("westus"), // Properties: &armnetapp.BackupPolicyProperties{ // DailyBackupsToKeep: to.Ptr[int32](10), @@ -143,7 +143,7 @@ func ExampleBackupPoliciesClient_BeginCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/BackupPolicies_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupPolicies_Update.json func ExampleBackupPoliciesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -176,7 +176,7 @@ func ExampleBackupPoliciesClient_BeginUpdate() { // res.BackupPolicy = armnetapp.BackupPolicy{ // Name: to.Ptr("account1/backupPolicyName"), // Type: to.Ptr("Microsoft.NetApp/netAppAccounts/backupPolicies"), - // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupPolocies/backupPolicyName"), + // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupPolicies/backupPolicyName"), // Location: to.Ptr("westus"), // Properties: &armnetapp.BackupPolicyProperties{ // DailyBackupsToKeep: to.Ptr[int32](5), @@ -195,7 +195,7 @@ func ExampleBackupPoliciesClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/BackupPolicies_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupPolicies_Delete.json func ExampleBackupPoliciesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/backups_client.go b/sdk/resourcemanager/netapp/armnetapp/backups_client.go index 834d7588bbf0..1d623382eec3 100644 --- a/sdk/resourcemanager/netapp/armnetapp/backups_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/backups_client.go @@ -28,7 +28,7 @@ type BackupsClient struct { } // NewBackupsClient creates a new instance of BackupsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewBackupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupsClient, error) { @@ -43,10 +43,334 @@ func NewBackupsClient(subscriptionID string, credential azcore.TokenCredential, return client, nil } +// BeginCreate - Create a backup under the Backup Vault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - backupVaultName - The name of the Backup Vault +// - backupName - The name of the backup +// - body - Backup object supplied in the body of the operation. +// - options - BackupsClientBeginCreateOptions contains the optional parameters for the BackupsClient.BeginCreate method. +func (client *BackupsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, body Backup, options *BackupsClientBeginCreateOptions) (*runtime.Poller[BackupsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, accountName, backupVaultName, backupName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BackupsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a backup under the Backup Vault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *BackupsClient) create(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, body Backup, options *BackupsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "BackupsClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, backupVaultName, backupName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *BackupsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, body Backup, options *BackupsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupVaultName == "" { + return nil, errors.New("parameter backupVaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupVaultName}", url.PathEscape(backupVaultName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a Backup under the Backup Vault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - backupVaultName - The name of the Backup Vault +// - backupName - The name of the backup +// - options - BackupsClientBeginDeleteOptions contains the optional parameters for the BackupsClient.BeginDelete method. +func (client *BackupsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, options *BackupsClientBeginDeleteOptions) (*runtime.Poller[BackupsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, backupVaultName, backupName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BackupsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Backup under the Backup Vault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *BackupsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, options *BackupsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "BackupsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, backupVaultName, backupName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *BackupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, options *BackupsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupVaultName == "" { + return nil, errors.New("parameter backupVaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupVaultName}", url.PathEscape(backupVaultName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the specified Backup under Backup Vault. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - backupVaultName - The name of the Backup Vault +// - backupName - The name of the backup +// - options - BackupsClientGetOptions contains the optional parameters for the BackupsClient.Get method. +func (client *BackupsClient) Get(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, options *BackupsClientGetOptions) (BackupsClientGetResponse, error) { + var err error + const operationName = "BackupsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, backupVaultName, backupName, options) + if err != nil { + return BackupsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BackupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BackupsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *BackupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, options *BackupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupVaultName == "" { + return nil, errors.New("parameter backupVaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupVaultName}", url.PathEscape(backupVaultName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *BackupsClient) getHandleResponse(resp *http.Response) (BackupsClientGetResponse, error) { + result := BackupsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Backup); err != nil { + return BackupsClientGetResponse{}, err + } + return result, nil +} + +// GetLatestStatus - Get the latest status of the backup for a volume +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - poolName - The name of the capacity pool +// - volumeName - The name of the volume +// - options - BackupsClientGetLatestStatusOptions contains the optional parameters for the BackupsClient.GetLatestStatus method. +func (client *BackupsClient) GetLatestStatus(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *BackupsClientGetLatestStatusOptions) (BackupsClientGetLatestStatusResponse, error) { + var err error + const operationName = "BackupsClient.GetLatestStatus" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getLatestStatusCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) + if err != nil { + return BackupsClientGetLatestStatusResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BackupsClientGetLatestStatusResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BackupsClientGetLatestStatusResponse{}, err + } + resp, err := client.getLatestStatusHandleResponse(httpResp) + return resp, err +} + +// getLatestStatusCreateRequest creates the GetLatestStatus request. +func (client *BackupsClient) getLatestStatusCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *BackupsClientGetLatestStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/latestBackupStatus/current" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getLatestStatusHandleResponse handles the GetLatestStatus response. +func (client *BackupsClient) getLatestStatusHandleResponse(resp *http.Response) (BackupsClientGetLatestStatusResponse, error) { + result := BackupsClientGetLatestStatusResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupStatus); err != nil { + return BackupsClientGetLatestStatusResponse{}, err + } + return result, nil +} + // GetVolumeRestoreStatus - Get the status of the restore for a volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -103,7 +427,7 @@ func (client *BackupsClient) getVolumeRestoreStatusCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,3 +441,165 @@ func (client *BackupsClient) getVolumeRestoreStatusHandleResponse(resp *http.Res } return result, nil } + +// NewListByVaultPager - List all backups Under a Backup Vault +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - backupVaultName - The name of the Backup Vault +// - options - BackupsClientListByVaultOptions contains the optional parameters for the BackupsClient.NewListByVaultPager method. +func (client *BackupsClient) NewListByVaultPager(resourceGroupName string, accountName string, backupVaultName string, options *BackupsClientListByVaultOptions) *runtime.Pager[BackupsClientListByVaultResponse] { + return runtime.NewPager(runtime.PagingHandler[BackupsClientListByVaultResponse]{ + More: func(page BackupsClientListByVaultResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BackupsClientListByVaultResponse) (BackupsClientListByVaultResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BackupsClient.NewListByVaultPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByVaultCreateRequest(ctx, resourceGroupName, accountName, backupVaultName, options) + }, nil) + if err != nil { + return BackupsClientListByVaultResponse{}, err + } + return client.listByVaultHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByVaultCreateRequest creates the ListByVault request. +func (client *BackupsClient) listByVaultCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, options *BackupsClientListByVaultOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupVaultName == "" { + return nil, errors.New("parameter backupVaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupVaultName}", url.PathEscape(backupVaultName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByVaultHandleResponse handles the ListByVault response. +func (client *BackupsClient) listByVaultHandleResponse(resp *http.Response) (BackupsClientListByVaultResponse, error) { + result := BackupsClientListByVaultResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupsList); err != nil { + return BackupsClientListByVaultResponse{}, err + } + return result, nil +} + +// BeginUpdate - Patch a Backup under the Backup Vault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - backupVaultName - The name of the Backup Vault +// - backupName - The name of the backup +// - body - Backup object supplied in the body of the operation. +// - options - BackupsClientBeginUpdateOptions contains the optional parameters for the BackupsClient.BeginUpdate method. +func (client *BackupsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, body BackupPatch, options *BackupsClientBeginUpdateOptions) (*runtime.Poller[BackupsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, accountName, backupVaultName, backupName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BackupsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Patch a Backup under the Backup Vault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *BackupsClient) update(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, body BackupPatch, options *BackupsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "BackupsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, backupVaultName, backupName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *BackupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, body BackupPatch, options *BackupsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupVaultName == "" { + return nil, errors.New("parameter backupVaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupVaultName}", url.PathEscape(backupVaultName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/netapp/armnetapp/backups_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/backups_client_example_test.go index 78c96de45f2d..898a4157f13a 100644 --- a/sdk/resourcemanager/netapp/armnetapp/backups_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/backups_client_example_test.go @@ -13,11 +13,42 @@ 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/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_RestoreStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_LatestBackupStatus.json +func ExampleBackupsClient_GetLatestStatus() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewBackupsClient().GetLatestStatus(ctx, "myRG", "account1", "pool1", "volume1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.BackupStatus = armnetapp.BackupStatus{ + // ErrorMessage: to.Ptr(""), + // Healthy: to.Ptr(true), + // LastTransferSize: to.Ptr[int64](100000), + // LastTransferType: to.Ptr(""), + // MirrorState: to.Ptr(armnetapp.MirrorStateMirrored), + // RelationshipStatus: to.Ptr(armnetapp.RelationshipStatusIdle), + // TotalTransferBytes: to.Ptr[int64](100000), + // UnhealthyReason: to.Ptr(""), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_RestoreStatus.json func ExampleBackupsClient_GetVolumeRestoreStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -44,3 +75,181 @@ func ExampleBackupsClient_GetVolumeRestoreStatus() { // UnhealthyReason: to.Ptr(""), // } } + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupsUnderBackupVault_List.json +func ExampleBackupsClient_NewListByVaultPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewBackupsClient().NewListByVaultPager("myRG", "account1", "backupVault1", &armnetapp.BackupsClientListByVaultOptions{Filter: nil}) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.BackupsList = armnetapp.BackupsList{ + // Value: []*armnetapp.Backup{ + // { + // Name: to.Ptr("account1/backupVault1/backup1"), + // Type: to.Ptr("Microsoft.NetApp/netAppAccounts/backupVaults/backups"), + // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupVaults/backupVault1/backups/backup1"), + // Properties: &armnetapp.BackupProperties{ + // BackupType: to.Ptr(armnetapp.BackupTypeManual), + // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-15T13:23:33.000Z"); return t}()), + // Label: to.Ptr("myLabel"), + // ProvisioningState: to.Ptr("Succeeded"), + // Size: to.Ptr[int64](10011), + // SnapshotName: to.Ptr("backup1"), + // VolumeResourceID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPool/pool1/volumes/volume1"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupsUnderBackupVault_Get.json +func ExampleBackupsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewBackupsClient().Get(ctx, "myRG", "account1", "backupVault1", "backup1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Backup = armnetapp.Backup{ + // Name: to.Ptr("account1/backupVault1/backup1"), + // Type: to.Ptr("Microsoft.NetApp/netAppAccounts/backupVaults/backups"), + // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupVaults/backupVault1/backups/backup1"), + // Properties: &armnetapp.BackupProperties{ + // BackupType: to.Ptr(armnetapp.BackupTypeManual), + // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-15T13:23:33.000Z"); return t}()), + // Label: to.Ptr("myLabel"), + // ProvisioningState: to.Ptr("Succeeded"), + // Size: to.Ptr[int64](10011), + // SnapshotName: to.Ptr("backup1"), + // VolumeResourceID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPool/pool1/volumes/volume1"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupsUnderBackupVault_Create.json +func ExampleBackupsClient_BeginCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewBackupsClient().BeginCreate(ctx, "myRG", "account1", "backupVault1", "backup1", armnetapp.Backup{ + Properties: &armnetapp.BackupProperties{ + Label: to.Ptr("myLabel"), + VolumeResourceID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPool/pool1/volumes/volume1"), + }, + }, 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) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Backup = armnetapp.Backup{ + // Name: to.Ptr("account1/backupVault1/backup1"), + // Type: to.Ptr("Microsoft.NetApp/netAppAccounts/backupVaults/backups"), + // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupVaults/backupVault1/backups/backup1"), + // Properties: &armnetapp.BackupProperties{ + // BackupType: to.Ptr(armnetapp.BackupTypeManual), + // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-15T13:23:33.000Z"); return t}()), + // Label: to.Ptr("myLabel"), + // ProvisioningState: to.Ptr("Succeeded"), + // Size: to.Ptr[int64](10011), + // SnapshotName: to.Ptr("backup1"), + // VolumeResourceID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPool/pool1/volumes/volume1"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupsUnderBackupVault_Update.json +func ExampleBackupsClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewBackupsClient().BeginUpdate(ctx, "myRG", "account1", "backupVault1", "backup1", armnetapp.BackupPatch{}, 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) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Backup = armnetapp.Backup{ + // Name: to.Ptr("account1/backupVault1/backup1"), + // Type: to.Ptr("Microsoft.NetApp/netAppAccounts/backupVaults/backups"), + // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupVaults/backupVault1/backups/backup1"), + // Properties: &armnetapp.BackupProperties{ + // BackupType: to.Ptr(armnetapp.BackupTypeManual), + // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-15T13:23:33.000Z"); return t}()), + // Label: to.Ptr("myLabel"), + // ProvisioningState: to.Ptr("Succeeded"), + // Size: to.Ptr[int64](10011), + // SnapshotName: to.Ptr("backup1"), + // VolumeResourceID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPool/pool1/volumes/volume1"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupsUnderBackupVault_Delete.json +func ExampleBackupsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewBackupsClient().BeginDelete(ctx, "resourceGroup", "account1", "backupVault1", "backup1", 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/netapp/armnetapp/backupsunderaccount_client.go b/sdk/resourcemanager/netapp/armnetapp/backupsunderaccount_client.go new file mode 100644 index 000000000000..d96f662de940 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/backupsunderaccount_client.go @@ -0,0 +1,125 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BackupsUnderAccountClient contains the methods for the BackupsUnderAccount group. +// Don't use this type directly, use NewBackupsUnderAccountClient() instead. +type BackupsUnderAccountClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBackupsUnderAccountClient creates a new instance of BackupsUnderAccountClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBackupsUnderAccountClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupsUnderAccountClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BackupsUnderAccountClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginMigrateBackups - Migrate the backups under a NetApp account to backup vault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - body - Migrate backups under an account payload supplied in the body of the operation. +// - options - BackupsUnderAccountClientBeginMigrateBackupsOptions contains the optional parameters for the BackupsUnderAccountClient.BeginMigrateBackups +// method. +func (client *BackupsUnderAccountClient) BeginMigrateBackups(ctx context.Context, resourceGroupName string, accountName string, body BackupsMigrationRequest, options *BackupsUnderAccountClientBeginMigrateBackupsOptions) (*runtime.Poller[BackupsUnderAccountClientMigrateBackupsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.migrateBackups(ctx, resourceGroupName, accountName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupsUnderAccountClientMigrateBackupsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BackupsUnderAccountClientMigrateBackupsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// MigrateBackups - Migrate the backups under a NetApp account to backup vault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *BackupsUnderAccountClient) migrateBackups(ctx context.Context, resourceGroupName string, accountName string, body BackupsMigrationRequest, options *BackupsUnderAccountClientBeginMigrateBackupsOptions) (*http.Response, error) { + var err error + const operationName = "BackupsUnderAccountClient.BeginMigrateBackups" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.migrateBackupsCreateRequest(ctx, resourceGroupName, accountName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// migrateBackupsCreateRequest creates the MigrateBackups request. +func (client *BackupsUnderAccountClient) migrateBackupsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, body BackupsMigrationRequest, options *BackupsUnderAccountClientBeginMigrateBackupsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/migrateBackups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/netapp/armnetapp/backupsunderaccount_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/backupsunderaccount_client_example_test.go new file mode 100644 index 000000000000..505924f83693 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/backupsunderaccount_client_example_test.go @@ -0,0 +1,42 @@ +//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. +// DO NOT EDIT. + +package armnetapp_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/netapp/armnetapp/v6" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupsUnderAccount_Migrate.json +func ExampleBackupsUnderAccountClient_BeginMigrateBackups() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewBackupsUnderAccountClient().BeginMigrateBackups(ctx, "myRG", "account1", armnetapp.BackupsMigrationRequest{ + BackupVaultID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupVaults/backupVault1"), + }, 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/netapp/armnetapp/backupsunderbackupvault_client.go b/sdk/resourcemanager/netapp/armnetapp/backupsunderbackupvault_client.go new file mode 100644 index 000000000000..29c29e8d11e9 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/backupsunderbackupvault_client.go @@ -0,0 +1,135 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BackupsUnderBackupVaultClient contains the methods for the BackupsUnderBackupVault group. +// Don't use this type directly, use NewBackupsUnderBackupVaultClient() instead. +type BackupsUnderBackupVaultClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBackupsUnderBackupVaultClient creates a new instance of BackupsUnderBackupVaultClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBackupsUnderBackupVaultClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupsUnderBackupVaultClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BackupsUnderBackupVaultClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginRestoreFiles - Restore the specified files from the specified backup to the active filesystem +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - backupVaultName - The name of the Backup Vault +// - backupName - The name of the backup +// - body - Restore payload supplied in the body of the operation. +// - options - BackupsUnderBackupVaultClientBeginRestoreFilesOptions contains the optional parameters for the BackupsUnderBackupVaultClient.BeginRestoreFiles +// method. +func (client *BackupsUnderBackupVaultClient) BeginRestoreFiles(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, body BackupRestoreFiles, options *BackupsUnderBackupVaultClientBeginRestoreFilesOptions) (*runtime.Poller[BackupsUnderBackupVaultClientRestoreFilesResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restoreFiles(ctx, resourceGroupName, accountName, backupVaultName, backupName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupsUnderBackupVaultClientRestoreFilesResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BackupsUnderBackupVaultClientRestoreFilesResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// RestoreFiles - Restore the specified files from the specified backup to the active filesystem +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *BackupsUnderBackupVaultClient) restoreFiles(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, body BackupRestoreFiles, options *BackupsUnderBackupVaultClientBeginRestoreFilesOptions) (*http.Response, error) { + var err error + const operationName = "BackupsUnderBackupVaultClient.BeginRestoreFiles" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.restoreFilesCreateRequest(ctx, resourceGroupName, accountName, backupVaultName, backupName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// restoreFilesCreateRequest creates the RestoreFiles request. +func (client *BackupsUnderBackupVaultClient) restoreFilesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, body BackupRestoreFiles, options *BackupsUnderBackupVaultClientBeginRestoreFilesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}/backups/{backupName}/restoreFiles" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupVaultName == "" { + return nil, errors.New("parameter backupVaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupVaultName}", url.PathEscape(backupVaultName)) + if backupName == "" { + return nil, errors.New("parameter backupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupName}", url.PathEscape(backupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/netapp/armnetapp/backupsunderbackupvault_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/backupsunderbackupvault_client_example_test.go new file mode 100644 index 000000000000..ff47b8aa68ca --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/backupsunderbackupvault_client_example_test.go @@ -0,0 +1,45 @@ +//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. +// DO NOT EDIT. + +package armnetapp_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/netapp/armnetapp/v6" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupsUnderBackupVault_SingleFileRestore.json +func ExampleBackupsUnderBackupVaultClient_BeginRestoreFiles() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewBackupsUnderBackupVaultClient().BeginRestoreFiles(ctx, "myRG", "account1", "backupVault1", "backup1", armnetapp.BackupRestoreFiles{ + DestinationVolumeID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1"), + FileList: []*string{ + to.Ptr("/dir1/customer1.db"), + to.Ptr("/dir1/customer2.db")}, + }, 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/netapp/armnetapp/backupsundervolume_client.go b/sdk/resourcemanager/netapp/armnetapp/backupsundervolume_client.go new file mode 100644 index 000000000000..05013131fbed --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/backupsundervolume_client.go @@ -0,0 +1,135 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BackupsUnderVolumeClient contains the methods for the BackupsUnderVolume group. +// Don't use this type directly, use NewBackupsUnderVolumeClient() instead. +type BackupsUnderVolumeClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBackupsUnderVolumeClient creates a new instance of BackupsUnderVolumeClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBackupsUnderVolumeClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupsUnderVolumeClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BackupsUnderVolumeClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginMigrateBackups - Migrate the backups under volume to backup vault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - poolName - The name of the capacity pool +// - volumeName - The name of the volume +// - body - Migrate backups under volume payload supplied in the body of the operation. +// - options - BackupsUnderVolumeClientBeginMigrateBackupsOptions contains the optional parameters for the BackupsUnderVolumeClient.BeginMigrateBackups +// method. +func (client *BackupsUnderVolumeClient) BeginMigrateBackups(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body BackupsMigrationRequest, options *BackupsUnderVolumeClientBeginMigrateBackupsOptions) (*runtime.Poller[BackupsUnderVolumeClientMigrateBackupsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.migrateBackups(ctx, resourceGroupName, accountName, poolName, volumeName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupsUnderVolumeClientMigrateBackupsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BackupsUnderVolumeClientMigrateBackupsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// MigrateBackups - Migrate the backups under volume to backup vault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *BackupsUnderVolumeClient) migrateBackups(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body BackupsMigrationRequest, options *BackupsUnderVolumeClientBeginMigrateBackupsOptions) (*http.Response, error) { + var err error + const operationName = "BackupsUnderVolumeClient.BeginMigrateBackups" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.migrateBackupsCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// migrateBackupsCreateRequest creates the MigrateBackups request. +func (client *BackupsUnderVolumeClient) migrateBackupsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body BackupsMigrationRequest, options *BackupsUnderVolumeClientBeginMigrateBackupsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/migrateBackups" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/netapp/armnetapp/backupsundervolume_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/backupsundervolume_client_example_test.go new file mode 100644 index 000000000000..00d037e56cf1 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/backupsundervolume_client_example_test.go @@ -0,0 +1,42 @@ +//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. +// DO NOT EDIT. + +package armnetapp_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/netapp/armnetapp/v6" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupsUnderVolume_Migrate.json +func ExampleBackupsUnderVolumeClient_BeginMigrateBackups() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewBackupsUnderVolumeClient().BeginMigrateBackups(ctx, "myRG", "account1", "pool1", "volume1", armnetapp.BackupsMigrationRequest{ + BackupVaultID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupVaults/backupVault1"), + }, 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/netapp/armnetapp/backupvaults_client.go b/sdk/resourcemanager/netapp/armnetapp/backupvaults_client.go new file mode 100644 index 000000000000..2797f869c2dc --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/backupvaults_client.go @@ -0,0 +1,432 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BackupVaultsClient contains the methods for the BackupVaults group. +// Don't use this type directly, use NewBackupVaultsClient() instead. +type BackupVaultsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBackupVaultsClient creates a new instance of BackupVaultsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBackupVaultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupVaultsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BackupVaultsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update the specified Backup Vault in the NetApp account +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - backupVaultName - The name of the Backup Vault +// - body - BackupVault object supplied in the body of the operation. +// - options - BackupVaultsClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupVaultsClient.BeginCreateOrUpdate +// method. +func (client *BackupVaultsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, body BackupVault, options *BackupVaultsClientBeginCreateOrUpdateOptions) (*runtime.Poller[BackupVaultsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, accountName, backupVaultName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupVaultsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BackupVaultsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create or update the specified Backup Vault in the NetApp account +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *BackupVaultsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, body BackupVault, options *BackupVaultsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "BackupVaultsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, backupVaultName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *BackupVaultsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, body BackupVault, options *BackupVaultsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupVaultName == "" { + return nil, errors.New("parameter backupVaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupVaultName}", url.PathEscape(backupVaultName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete the specified Backup Vault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - backupVaultName - The name of the Backup Vault +// - options - BackupVaultsClientBeginDeleteOptions contains the optional parameters for the BackupVaultsClient.BeginDelete +// method. +func (client *BackupVaultsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, options *BackupVaultsClientBeginDeleteOptions) (*runtime.Poller[BackupVaultsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, backupVaultName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupVaultsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BackupVaultsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete the specified Backup Vault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *BackupVaultsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, options *BackupVaultsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "BackupVaultsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, backupVaultName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *BackupVaultsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, options *BackupVaultsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupVaultName == "" { + return nil, errors.New("parameter backupVaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupVaultName}", url.PathEscape(backupVaultName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the Backup Vault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - backupVaultName - The name of the Backup Vault +// - options - BackupVaultsClientGetOptions contains the optional parameters for the BackupVaultsClient.Get method. +func (client *BackupVaultsClient) Get(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, options *BackupVaultsClientGetOptions) (BackupVaultsClientGetResponse, error) { + var err error + const operationName = "BackupVaultsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, backupVaultName, options) + if err != nil { + return BackupVaultsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BackupVaultsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BackupVaultsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *BackupVaultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, options *BackupVaultsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupVaultName == "" { + return nil, errors.New("parameter backupVaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupVaultName}", url.PathEscape(backupVaultName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *BackupVaultsClient) getHandleResponse(resp *http.Response) (BackupVaultsClientGetResponse, error) { + result := BackupVaultsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupVault); err != nil { + return BackupVaultsClientGetResponse{}, err + } + return result, nil +} + +// NewListByNetAppAccountPager - List and describe all Backup Vaults in the NetApp account. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - options - BackupVaultsClientListByNetAppAccountOptions contains the optional parameters for the BackupVaultsClient.NewListByNetAppAccountPager +// method. +func (client *BackupVaultsClient) NewListByNetAppAccountPager(resourceGroupName string, accountName string, options *BackupVaultsClientListByNetAppAccountOptions) *runtime.Pager[BackupVaultsClientListByNetAppAccountResponse] { + return runtime.NewPager(runtime.PagingHandler[BackupVaultsClientListByNetAppAccountResponse]{ + More: func(page BackupVaultsClientListByNetAppAccountResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BackupVaultsClientListByNetAppAccountResponse) (BackupVaultsClientListByNetAppAccountResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BackupVaultsClient.NewListByNetAppAccountPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByNetAppAccountCreateRequest(ctx, resourceGroupName, accountName, options) + }, nil) + if err != nil { + return BackupVaultsClientListByNetAppAccountResponse{}, err + } + return client.listByNetAppAccountHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByNetAppAccountCreateRequest creates the ListByNetAppAccount request. +func (client *BackupVaultsClient) listByNetAppAccountCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *BackupVaultsClientListByNetAppAccountOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByNetAppAccountHandleResponse handles the ListByNetAppAccount response. +func (client *BackupVaultsClient) listByNetAppAccountHandleResponse(resp *http.Response) (BackupVaultsClientListByNetAppAccountResponse, error) { + result := BackupVaultsClientListByNetAppAccountResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupVaultsList); err != nil { + return BackupVaultsClientListByNetAppAccountResponse{}, err + } + return result, nil +} + +// BeginUpdate - Patch the specified NetApp Backup Vault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - backupVaultName - The name of the Backup Vault +// - body - Backup Vault object supplied in the body of the operation. +// - options - BackupVaultsClientBeginUpdateOptions contains the optional parameters for the BackupVaultsClient.BeginUpdate +// method. +func (client *BackupVaultsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, body BackupVaultPatch, options *BackupVaultsClientBeginUpdateOptions) (*runtime.Poller[BackupVaultsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, accountName, backupVaultName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupVaultsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BackupVaultsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Patch the specified NetApp Backup Vault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *BackupVaultsClient) update(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, body BackupVaultPatch, options *BackupVaultsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "BackupVaultsClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, backupVaultName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *BackupVaultsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, body BackupVaultPatch, options *BackupVaultsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupVaults/{backupVaultName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if backupVaultName == "" { + return nil, errors.New("parameter backupVaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupVaultName}", url.PathEscape(backupVaultName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/netapp/armnetapp/backupvaults_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/backupvaults_client_example_test.go new file mode 100644 index 000000000000..71e03d478e5c --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/backupvaults_client_example_test.go @@ -0,0 +1,187 @@ +//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. +// DO NOT EDIT. + +package armnetapp_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/netapp/armnetapp/v6" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupVaults_List.json +func ExampleBackupVaultsClient_NewListByNetAppAccountPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewBackupVaultsClient().NewListByNetAppAccountPager("myRG", "account1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.BackupVaultsList = armnetapp.BackupVaultsList{ + // Value: []*armnetapp.BackupVault{ + // { + // Name: to.Ptr("account1/backupVault1"), + // Type: to.Ptr("Microsoft.NetApp/netAppAccounts/backupVaults"), + // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupVaults/backupVault1"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "Tag1": to.Ptr("Value1"), + // }, + // Properties: &armnetapp.BackupVaultProperties{ + // ProvisioningState: to.Ptr("Succeeded"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupVaults_Get.json +func ExampleBackupVaultsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewBackupVaultsClient().Get(ctx, "myRG", "account1", "backupVault1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.BackupVault = armnetapp.BackupVault{ + // Name: to.Ptr("account1/backupVault1"), + // Type: to.Ptr("Microsoft.NetApp/netAppAccounts/backupVaults"), + // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupVaults/backupVault1"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "Tag1": to.Ptr("Value1"), + // }, + // Properties: &armnetapp.BackupVaultProperties{ + // ProvisioningState: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupVaults_Create.json +func ExampleBackupVaultsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewBackupVaultsClient().BeginCreateOrUpdate(ctx, "myRG", "account1", "backupVault1", armnetapp.BackupVault{ + Location: to.Ptr("eastus"), + }, 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) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.BackupVault = armnetapp.BackupVault{ + // Name: to.Ptr("account1/backupVault1"), + // Type: to.Ptr("Microsoft.NetApp/netAppAccounts/backupVaults"), + // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupVaults/backupVault1"), + // Location: to.Ptr("eastus"), + // Properties: &armnetapp.BackupVaultProperties{ + // ProvisioningState: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupVaults_Update.json +func ExampleBackupVaultsClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewBackupVaultsClient().BeginUpdate(ctx, "myRG", "account1", "backupVault1", armnetapp.BackupVaultPatch{ + Tags: map[string]*string{ + "Tag1": to.Ptr("Value1"), + }, + }, 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) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.BackupVault = armnetapp.BackupVault{ + // Name: to.Ptr("account1/backupVault1"), + // Type: to.Ptr("Microsoft.NetApp/netAppAccounts/backupVaults"), + // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/backupVaults/backupVault1"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "Tag1": to.Ptr("Value1"), + // }, + // Properties: &armnetapp.BackupVaultProperties{ + // ProvisioningState: to.Ptr("Succeeded"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/BackupVaults_Delete.json +func ExampleBackupVaultsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewBackupVaultsClient().BeginDelete(ctx, "resourceGroup", "account1", "backupVault1", 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/netapp/armnetapp/client_factory.go b/sdk/resourcemanager/netapp/armnetapp/client_factory.go index 02882122f1d2..a58510ee706b 100644 --- a/sdk/resourcemanager/netapp/armnetapp/client_factory.go +++ b/sdk/resourcemanager/netapp/armnetapp/client_factory.go @@ -23,7 +23,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { @@ -37,6 +37,12 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } +// NewAccountBackupsClient creates a new instance of AccountBackupsClient. +func (c *ClientFactory) NewAccountBackupsClient() *AccountBackupsClient { + subClient, _ := NewAccountBackupsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + // NewAccountsClient creates a new instance of AccountsClient. func (c *ClientFactory) NewAccountsClient() *AccountsClient { subClient, _ := NewAccountsClient(c.subscriptionID, c.credential, c.options) @@ -49,12 +55,36 @@ func (c *ClientFactory) NewBackupPoliciesClient() *BackupPoliciesClient { return subClient } +// NewBackupVaultsClient creates a new instance of BackupVaultsClient. +func (c *ClientFactory) NewBackupVaultsClient() *BackupVaultsClient { + subClient, _ := NewBackupVaultsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + // NewBackupsClient creates a new instance of BackupsClient. func (c *ClientFactory) NewBackupsClient() *BackupsClient { subClient, _ := NewBackupsClient(c.subscriptionID, c.credential, c.options) return subClient } +// NewBackupsUnderAccountClient creates a new instance of BackupsUnderAccountClient. +func (c *ClientFactory) NewBackupsUnderAccountClient() *BackupsUnderAccountClient { + subClient, _ := NewBackupsUnderAccountClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewBackupsUnderBackupVaultClient creates a new instance of BackupsUnderBackupVaultClient. +func (c *ClientFactory) NewBackupsUnderBackupVaultClient() *BackupsUnderBackupVaultClient { + subClient, _ := NewBackupsUnderBackupVaultClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewBackupsUnderVolumeClient creates a new instance of BackupsUnderVolumeClient. +func (c *ClientFactory) NewBackupsUnderVolumeClient() *BackupsUnderVolumeClient { + subClient, _ := NewBackupsUnderVolumeClient(c.subscriptionID, c.credential, c.options) + return subClient +} + // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) @@ -79,6 +109,12 @@ func (c *ClientFactory) NewResourceQuotaLimitsClient() *ResourceQuotaLimitsClien return subClient } +// NewResourceRegionInfosClient creates a new instance of ResourceRegionInfosClient. +func (c *ClientFactory) NewResourceRegionInfosClient() *ResourceRegionInfosClient { + subClient, _ := NewResourceRegionInfosClient(c.subscriptionID, c.credential, c.options) + return subClient +} + // NewSnapshotPoliciesClient creates a new instance of SnapshotPoliciesClient. func (c *ClientFactory) NewSnapshotPoliciesClient() *SnapshotPoliciesClient { subClient, _ := NewSnapshotPoliciesClient(c.subscriptionID, c.credential, c.options) diff --git a/sdk/resourcemanager/netapp/armnetapp/constants.go b/sdk/resourcemanager/netapp/armnetapp/constants.go index ede207908152..fd2a78038966 100644 --- a/sdk/resourcemanager/netapp/armnetapp/constants.go +++ b/sdk/resourcemanager/netapp/armnetapp/constants.go @@ -10,7 +10,7 @@ package armnetapp const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp" - moduleVersion = "v5.1.0" + moduleVersion = "v6.0.0-beta.1" ) // ActiveDirectoryStatus - Status of the Active Directory @@ -74,6 +74,24 @@ func PossibleAvsDataStoreValues() []AvsDataStore { } } +// BackupType - Type of backup Manual or Scheduled +type BackupType string + +const ( + // BackupTypeManual - Manual backup + BackupTypeManual BackupType = "Manual" + // BackupTypeScheduled - Scheduled backup + BackupTypeScheduled BackupType = "Scheduled" +) + +// PossibleBackupTypeValues returns the possible values for the BackupType const type. +func PossibleBackupTypeValues() []BackupType { + return []BackupType{ + BackupTypeManual, + BackupTypeScheduled, + } +} + // CheckNameResourceTypes - Resource type used for verification. type CheckNameResourceTypes string diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/accountbackups_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/accountbackups_server.go new file mode 100644 index 000000000000..25c9a6102ad6 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/fake/accountbackups_server.go @@ -0,0 +1,220 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" + "net/http" + "net/url" + "regexp" +) + +// AccountBackupsServer is a fake server for instances of the armnetapp.AccountBackupsClient type. +type AccountBackupsServer struct { + // BeginDelete is the fake for method AccountBackupsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, backupName string, options *armnetapp.AccountBackupsClientBeginDeleteOptions) (resp azfake.PollerResponder[armnetapp.AccountBackupsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AccountBackupsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, backupName string, options *armnetapp.AccountBackupsClientGetOptions) (resp azfake.Responder[armnetapp.AccountBackupsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByNetAppAccountPager is the fake for method AccountBackupsClient.NewListByNetAppAccountPager + // HTTP status codes to indicate success: http.StatusOK + NewListByNetAppAccountPager func(resourceGroupName string, accountName string, options *armnetapp.AccountBackupsClientListByNetAppAccountOptions) (resp azfake.PagerResponder[armnetapp.AccountBackupsClientListByNetAppAccountResponse]) +} + +// NewAccountBackupsServerTransport creates a new instance of AccountBackupsServerTransport with the provided implementation. +// The returned AccountBackupsServerTransport instance is connected to an instance of armnetapp.AccountBackupsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAccountBackupsServerTransport(srv *AccountBackupsServer) *AccountBackupsServerTransport { + return &AccountBackupsServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armnetapp.AccountBackupsClientDeleteResponse]](), + newListByNetAppAccountPager: newTracker[azfake.PagerResponder[armnetapp.AccountBackupsClientListByNetAppAccountResponse]](), + } +} + +// AccountBackupsServerTransport connects instances of armnetapp.AccountBackupsClient to instances of AccountBackupsServer. +// Don't use this type directly, use NewAccountBackupsServerTransport instead. +type AccountBackupsServerTransport struct { + srv *AccountBackupsServer + beginDelete *tracker[azfake.PollerResponder[armnetapp.AccountBackupsClientDeleteResponse]] + newListByNetAppAccountPager *tracker[azfake.PagerResponder[armnetapp.AccountBackupsClientListByNetAppAccountResponse]] +} + +// Do implements the policy.Transporter interface for AccountBackupsServerTransport. +func (a *AccountBackupsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "AccountBackupsClient.BeginDelete": + resp, err = a.dispatchBeginDelete(req) + case "AccountBackupsClient.Get": + resp, err = a.dispatchGet(req) + case "AccountBackupsClient.NewListByNetAppAccountPager": + resp, err = a.dispatchNewListByNetAppAccountPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (a *AccountBackupsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if a.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := a.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/accountBackups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + backupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameParam, accountNameParam, backupNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + a.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + a.beginDelete.remove(req) + } + + return resp, nil +} + +func (a *AccountBackupsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/accountBackups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + backupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, backupNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Backup, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AccountBackupsServerTransport) dispatchNewListByNetAppAccountPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByNetAppAccountPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByNetAppAccountPager not implemented")} + } + newListByNetAppAccountPager := a.newListByNetAppAccountPager.get(req) + if newListByNetAppAccountPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/accountBackups` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + includeOnlyBackupsFromDeletedVolumesUnescaped, err := url.QueryUnescape(qp.Get("includeOnlyBackupsFromDeletedVolumes")) + if err != nil { + return nil, err + } + includeOnlyBackupsFromDeletedVolumesParam := getOptional(includeOnlyBackupsFromDeletedVolumesUnescaped) + var options *armnetapp.AccountBackupsClientListByNetAppAccountOptions + if includeOnlyBackupsFromDeletedVolumesParam != nil { + options = &armnetapp.AccountBackupsClientListByNetAppAccountOptions{ + IncludeOnlyBackupsFromDeletedVolumes: includeOnlyBackupsFromDeletedVolumesParam, + } + } + resp := a.srv.NewListByNetAppAccountPager(resourceGroupNameParam, accountNameParam, options) + newListByNetAppAccountPager = &resp + a.newListByNetAppAccountPager.add(req, newListByNetAppAccountPager) + } + resp, err := server.PagerResponderNext(newListByNetAppAccountPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListByNetAppAccountPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByNetAppAccountPager) { + a.newListByNetAppAccountPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/accounts_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/accounts_server.go index bbc23bdec525..d2d98f598cfa 100644 --- a/sdk/resourcemanager/netapp/armnetapp/fake/accounts_server.go +++ b/sdk/resourcemanager/netapp/armnetapp/fake/accounts_server.go @@ -16,9 +16,10 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" "net/http" "net/url" + "reflect" "regexp" ) @@ -44,6 +45,10 @@ type AccountsServer struct { // HTTP status codes to indicate success: http.StatusOK NewListBySubscriptionPager func(options *armnetapp.AccountsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armnetapp.AccountsClientListBySubscriptionResponse]) + // BeginMigrateEncryptionKey is the fake for method AccountsClient.BeginMigrateEncryptionKey + // HTTP status codes to indicate success: http.StatusAccepted + BeginMigrateEncryptionKey func(ctx context.Context, resourceGroupName string, accountName string, options *armnetapp.AccountsClientBeginMigrateEncryptionKeyOptions) (resp azfake.PollerResponder[armnetapp.AccountsClientMigrateEncryptionKeyResponse], errResp azfake.ErrorResponder) + // BeginRenewCredentials is the fake for method AccountsClient.BeginRenewCredentials // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginRenewCredentials func(ctx context.Context, resourceGroupName string, accountName string, options *armnetapp.AccountsClientBeginRenewCredentialsOptions) (resp azfake.PollerResponder[armnetapp.AccountsClientRenewCredentialsResponse], errResp azfake.ErrorResponder) @@ -63,6 +68,7 @@ func NewAccountsServerTransport(srv *AccountsServer) *AccountsServerTransport { beginDelete: newTracker[azfake.PollerResponder[armnetapp.AccountsClientDeleteResponse]](), newListPager: newTracker[azfake.PagerResponder[armnetapp.AccountsClientListResponse]](), newListBySubscriptionPager: newTracker[azfake.PagerResponder[armnetapp.AccountsClientListBySubscriptionResponse]](), + beginMigrateEncryptionKey: newTracker[azfake.PollerResponder[armnetapp.AccountsClientMigrateEncryptionKeyResponse]](), beginRenewCredentials: newTracker[azfake.PollerResponder[armnetapp.AccountsClientRenewCredentialsResponse]](), beginUpdate: newTracker[azfake.PollerResponder[armnetapp.AccountsClientUpdateResponse]](), } @@ -76,6 +82,7 @@ type AccountsServerTransport struct { beginDelete *tracker[azfake.PollerResponder[armnetapp.AccountsClientDeleteResponse]] newListPager *tracker[azfake.PagerResponder[armnetapp.AccountsClientListResponse]] newListBySubscriptionPager *tracker[azfake.PagerResponder[armnetapp.AccountsClientListBySubscriptionResponse]] + beginMigrateEncryptionKey *tracker[azfake.PollerResponder[armnetapp.AccountsClientMigrateEncryptionKeyResponse]] beginRenewCredentials *tracker[azfake.PollerResponder[armnetapp.AccountsClientRenewCredentialsResponse]] beginUpdate *tracker[azfake.PollerResponder[armnetapp.AccountsClientUpdateResponse]] } @@ -102,6 +109,8 @@ func (a *AccountsServerTransport) Do(req *http.Request) (*http.Response, error) resp, err = a.dispatchNewListPager(req) case "AccountsClient.NewListBySubscriptionPager": resp, err = a.dispatchNewListBySubscriptionPager(req) + case "AccountsClient.BeginMigrateEncryptionKey": + resp, err = a.dispatchBeginMigrateEncryptionKey(req) case "AccountsClient.BeginRenewCredentials": resp, err = a.dispatchBeginRenewCredentials(req) case "AccountsClient.BeginUpdate": @@ -312,6 +321,60 @@ func (a *AccountsServerTransport) dispatchNewListBySubscriptionPager(req *http.R return resp, nil } +func (a *AccountsServerTransport) dispatchBeginMigrateEncryptionKey(req *http.Request) (*http.Response, error) { + if a.srv.BeginMigrateEncryptionKey == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginMigrateEncryptionKey not implemented")} + } + beginMigrateEncryptionKey := a.beginMigrateEncryptionKey.get(req) + if beginMigrateEncryptionKey == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/migrateEncryption` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armnetapp.EncryptionMigrationRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + var options *armnetapp.AccountsClientBeginMigrateEncryptionKeyOptions + if !reflect.ValueOf(body).IsZero() { + options = &armnetapp.AccountsClientBeginMigrateEncryptionKeyOptions{ + Body: &body, + } + } + respr, errRespr := a.srv.BeginMigrateEncryptionKey(req.Context(), resourceGroupNameParam, accountNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginMigrateEncryptionKey = &respr + a.beginMigrateEncryptionKey.add(req, beginMigrateEncryptionKey) + } + + resp, err := server.PollerResponderNext(beginMigrateEncryptionKey, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + a.beginMigrateEncryptionKey.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginMigrateEncryptionKey) { + a.beginMigrateEncryptionKey.remove(req) + } + + return resp, nil +} + func (a *AccountsServerTransport) dispatchBeginRenewCredentials(req *http.Request) (*http.Response, error) { if a.srv.BeginRenewCredentials == nil { return nil, &nonRetriableError{errors.New("fake for method BeginRenewCredentials not implemented")} diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/backuppolicies_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/backuppolicies_server.go index 7db358bcbfd4..f3247741c173 100644 --- a/sdk/resourcemanager/netapp/armnetapp/fake/backuppolicies_server.go +++ b/sdk/resourcemanager/netapp/armnetapp/fake/backuppolicies_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/backups_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/backups_server.go index e28451c8a423..ae8f559e5e0c 100644 --- a/sdk/resourcemanager/netapp/armnetapp/fake/backups_server.go +++ b/sdk/resourcemanager/netapp/armnetapp/fake/backups_server.go @@ -15,7 +15,8 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" "net/http" "net/url" "regexp" @@ -23,22 +24,56 @@ import ( // BackupsServer is a fake server for instances of the armnetapp.BackupsClient type. type BackupsServer struct { + // BeginCreate is the fake for method BackupsClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, body armnetapp.Backup, options *armnetapp.BackupsClientBeginCreateOptions) (resp azfake.PollerResponder[armnetapp.BackupsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method BackupsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, options *armnetapp.BackupsClientBeginDeleteOptions) (resp azfake.PollerResponder[armnetapp.BackupsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method BackupsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, options *armnetapp.BackupsClientGetOptions) (resp azfake.Responder[armnetapp.BackupsClientGetResponse], errResp azfake.ErrorResponder) + + // GetLatestStatus is the fake for method BackupsClient.GetLatestStatus + // HTTP status codes to indicate success: http.StatusOK + GetLatestStatus func(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *armnetapp.BackupsClientGetLatestStatusOptions) (resp azfake.Responder[armnetapp.BackupsClientGetLatestStatusResponse], errResp azfake.ErrorResponder) + // GetVolumeRestoreStatus is the fake for method BackupsClient.GetVolumeRestoreStatus // HTTP status codes to indicate success: http.StatusOK GetVolumeRestoreStatus func(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *armnetapp.BackupsClientGetVolumeRestoreStatusOptions) (resp azfake.Responder[armnetapp.BackupsClientGetVolumeRestoreStatusResponse], errResp azfake.ErrorResponder) + + // NewListByVaultPager is the fake for method BackupsClient.NewListByVaultPager + // HTTP status codes to indicate success: http.StatusOK + NewListByVaultPager func(resourceGroupName string, accountName string, backupVaultName string, options *armnetapp.BackupsClientListByVaultOptions) (resp azfake.PagerResponder[armnetapp.BackupsClientListByVaultResponse]) + + // BeginUpdate is the fake for method BackupsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, body armnetapp.BackupPatch, options *armnetapp.BackupsClientBeginUpdateOptions) (resp azfake.PollerResponder[armnetapp.BackupsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewBackupsServerTransport creates a new instance of BackupsServerTransport with the provided implementation. // The returned BackupsServerTransport instance is connected to an instance of armnetapp.BackupsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewBackupsServerTransport(srv *BackupsServer) *BackupsServerTransport { - return &BackupsServerTransport{srv: srv} + return &BackupsServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armnetapp.BackupsClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armnetapp.BackupsClientDeleteResponse]](), + newListByVaultPager: newTracker[azfake.PagerResponder[armnetapp.BackupsClientListByVaultResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armnetapp.BackupsClientUpdateResponse]](), + } } // BackupsServerTransport connects instances of armnetapp.BackupsClient to instances of BackupsServer. // Don't use this type directly, use NewBackupsServerTransport instead. type BackupsServerTransport struct { - srv *BackupsServer + srv *BackupsServer + beginCreate *tracker[azfake.PollerResponder[armnetapp.BackupsClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armnetapp.BackupsClientDeleteResponse]] + newListByVaultPager *tracker[azfake.PagerResponder[armnetapp.BackupsClientListByVaultResponse]] + beginUpdate *tracker[azfake.PollerResponder[armnetapp.BackupsClientUpdateResponse]] } // Do implements the policy.Transporter interface for BackupsServerTransport. @@ -53,8 +88,20 @@ func (b *BackupsServerTransport) Do(req *http.Request) (*http.Response, error) { var err error switch method { + case "BackupsClient.BeginCreate": + resp, err = b.dispatchBeginCreate(req) + case "BackupsClient.BeginDelete": + resp, err = b.dispatchBeginDelete(req) + case "BackupsClient.Get": + resp, err = b.dispatchGet(req) + case "BackupsClient.GetLatestStatus": + resp, err = b.dispatchGetLatestStatus(req) case "BackupsClient.GetVolumeRestoreStatus": resp, err = b.dispatchGetVolumeRestoreStatus(req) + case "BackupsClient.NewListByVaultPager": + resp, err = b.dispatchNewListByVaultPager(req) + case "BackupsClient.BeginUpdate": + resp, err = b.dispatchBeginUpdate(req) default: err = fmt.Errorf("unhandled API %s", method) } @@ -66,6 +113,196 @@ func (b *BackupsServerTransport) Do(req *http.Request) (*http.Response, error) { return resp, nil } +func (b *BackupsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if b.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := b.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armnetapp.Backup](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + backupVaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupVaultName")]) + if err != nil { + return nil, err + } + backupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.BeginCreate(req.Context(), resourceGroupNameParam, accountNameParam, backupVaultNameParam, backupNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + b.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + b.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + b.beginCreate.remove(req) + } + + return resp, nil +} + +func (b *BackupsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if b.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := b.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + backupVaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupVaultName")]) + if err != nil { + return nil, err + } + backupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.BeginDelete(req.Context(), resourceGroupNameParam, accountNameParam, backupVaultNameParam, backupNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + b.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + b.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + b.beginDelete.remove(req) + } + + return resp, nil +} + +func (b *BackupsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if b.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + backupVaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupVaultName")]) + if err != nil { + return nil, err + } + backupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, backupVaultNameParam, backupNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Backup, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (b *BackupsServerTransport) dispatchGetLatestStatus(req *http.Request) (*http.Response, error) { + if b.srv.GetLatestStatus == nil { + return nil, &nonRetriableError{errors.New("fake for method GetLatestStatus not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capacityPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/volumes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/latestBackupStatus/current` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + volumeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("volumeName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.GetLatestStatus(req.Context(), resourceGroupNameParam, accountNameParam, poolNameParam, volumeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BackupStatus, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (b *BackupsServerTransport) dispatchGetVolumeRestoreStatus(req *http.Request) (*http.Response, error) { if b.srv.GetVolumeRestoreStatus == nil { return nil, &nonRetriableError{errors.New("fake for method GetVolumeRestoreStatus not implemented")} @@ -106,3 +343,116 @@ func (b *BackupsServerTransport) dispatchGetVolumeRestoreStatus(req *http.Reques } return resp, nil } + +func (b *BackupsServerTransport) dispatchNewListByVaultPager(req *http.Request) (*http.Response, error) { + if b.srv.NewListByVaultPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByVaultPager not implemented")} + } + newListByVaultPager := b.newListByVaultPager.get(req) + if newListByVaultPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backups` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + backupVaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupVaultName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + var options *armnetapp.BackupsClientListByVaultOptions + if filterParam != nil { + options = &armnetapp.BackupsClientListByVaultOptions{ + Filter: filterParam, + } + } + resp := b.srv.NewListByVaultPager(resourceGroupNameParam, accountNameParam, backupVaultNameParam, options) + newListByVaultPager = &resp + b.newListByVaultPager.add(req, newListByVaultPager) + server.PagerResponderInjectNextLinks(newListByVaultPager, req, func(page *armnetapp.BackupsClientListByVaultResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByVaultPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + b.newListByVaultPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByVaultPager) { + b.newListByVaultPager.remove(req) + } + return resp, nil +} + +func (b *BackupsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if b.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := b.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armnetapp.BackupPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + backupVaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupVaultName")]) + if err != nil { + return nil, err + } + backupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.BeginUpdate(req.Context(), resourceGroupNameParam, accountNameParam, backupVaultNameParam, backupNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + b.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + b.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + b.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/backupsunderaccount_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/backupsunderaccount_server.go new file mode 100644 index 000000000000..734d0e8c5522 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/fake/backupsunderaccount_server.go @@ -0,0 +1,119 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" + "net/http" + "net/url" + "regexp" +) + +// BackupsUnderAccountServer is a fake server for instances of the armnetapp.BackupsUnderAccountClient type. +type BackupsUnderAccountServer struct { + // BeginMigrateBackups is the fake for method BackupsUnderAccountClient.BeginMigrateBackups + // HTTP status codes to indicate success: http.StatusAccepted + BeginMigrateBackups func(ctx context.Context, resourceGroupName string, accountName string, body armnetapp.BackupsMigrationRequest, options *armnetapp.BackupsUnderAccountClientBeginMigrateBackupsOptions) (resp azfake.PollerResponder[armnetapp.BackupsUnderAccountClientMigrateBackupsResponse], errResp azfake.ErrorResponder) +} + +// NewBackupsUnderAccountServerTransport creates a new instance of BackupsUnderAccountServerTransport with the provided implementation. +// The returned BackupsUnderAccountServerTransport instance is connected to an instance of armnetapp.BackupsUnderAccountClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewBackupsUnderAccountServerTransport(srv *BackupsUnderAccountServer) *BackupsUnderAccountServerTransport { + return &BackupsUnderAccountServerTransport{ + srv: srv, + beginMigrateBackups: newTracker[azfake.PollerResponder[armnetapp.BackupsUnderAccountClientMigrateBackupsResponse]](), + } +} + +// BackupsUnderAccountServerTransport connects instances of armnetapp.BackupsUnderAccountClient to instances of BackupsUnderAccountServer. +// Don't use this type directly, use NewBackupsUnderAccountServerTransport instead. +type BackupsUnderAccountServerTransport struct { + srv *BackupsUnderAccountServer + beginMigrateBackups *tracker[azfake.PollerResponder[armnetapp.BackupsUnderAccountClientMigrateBackupsResponse]] +} + +// Do implements the policy.Transporter interface for BackupsUnderAccountServerTransport. +func (b *BackupsUnderAccountServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "BackupsUnderAccountClient.BeginMigrateBackups": + resp, err = b.dispatchBeginMigrateBackups(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (b *BackupsUnderAccountServerTransport) dispatchBeginMigrateBackups(req *http.Request) (*http.Response, error) { + if b.srv.BeginMigrateBackups == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginMigrateBackups not implemented")} + } + beginMigrateBackups := b.beginMigrateBackups.get(req) + if beginMigrateBackups == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/migrateBackups` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armnetapp.BackupsMigrationRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.BeginMigrateBackups(req.Context(), resourceGroupNameParam, accountNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginMigrateBackups = &respr + b.beginMigrateBackups.add(req, beginMigrateBackups) + } + + resp, err := server.PollerResponderNext(beginMigrateBackups, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + b.beginMigrateBackups.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginMigrateBackups) { + b.beginMigrateBackups.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/backupsunderbackupvault_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/backupsunderbackupvault_server.go new file mode 100644 index 000000000000..4aac734f25a2 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/fake/backupsunderbackupvault_server.go @@ -0,0 +1,127 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" + "net/http" + "net/url" + "regexp" +) + +// BackupsUnderBackupVaultServer is a fake server for instances of the armnetapp.BackupsUnderBackupVaultClient type. +type BackupsUnderBackupVaultServer struct { + // BeginRestoreFiles is the fake for method BackupsUnderBackupVaultClient.BeginRestoreFiles + // HTTP status codes to indicate success: http.StatusAccepted + BeginRestoreFiles func(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, backupName string, body armnetapp.BackupRestoreFiles, options *armnetapp.BackupsUnderBackupVaultClientBeginRestoreFilesOptions) (resp azfake.PollerResponder[armnetapp.BackupsUnderBackupVaultClientRestoreFilesResponse], errResp azfake.ErrorResponder) +} + +// NewBackupsUnderBackupVaultServerTransport creates a new instance of BackupsUnderBackupVaultServerTransport with the provided implementation. +// The returned BackupsUnderBackupVaultServerTransport instance is connected to an instance of armnetapp.BackupsUnderBackupVaultClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewBackupsUnderBackupVaultServerTransport(srv *BackupsUnderBackupVaultServer) *BackupsUnderBackupVaultServerTransport { + return &BackupsUnderBackupVaultServerTransport{ + srv: srv, + beginRestoreFiles: newTracker[azfake.PollerResponder[armnetapp.BackupsUnderBackupVaultClientRestoreFilesResponse]](), + } +} + +// BackupsUnderBackupVaultServerTransport connects instances of armnetapp.BackupsUnderBackupVaultClient to instances of BackupsUnderBackupVaultServer. +// Don't use this type directly, use NewBackupsUnderBackupVaultServerTransport instead. +type BackupsUnderBackupVaultServerTransport struct { + srv *BackupsUnderBackupVaultServer + beginRestoreFiles *tracker[azfake.PollerResponder[armnetapp.BackupsUnderBackupVaultClientRestoreFilesResponse]] +} + +// Do implements the policy.Transporter interface for BackupsUnderBackupVaultServerTransport. +func (b *BackupsUnderBackupVaultServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "BackupsUnderBackupVaultClient.BeginRestoreFiles": + resp, err = b.dispatchBeginRestoreFiles(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (b *BackupsUnderBackupVaultServerTransport) dispatchBeginRestoreFiles(req *http.Request) (*http.Response, error) { + if b.srv.BeginRestoreFiles == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRestoreFiles not implemented")} + } + beginRestoreFiles := b.beginRestoreFiles.get(req) + if beginRestoreFiles == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/restoreFiles` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armnetapp.BackupRestoreFiles](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + backupVaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupVaultName")]) + if err != nil { + return nil, err + } + backupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.BeginRestoreFiles(req.Context(), resourceGroupNameParam, accountNameParam, backupVaultNameParam, backupNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRestoreFiles = &respr + b.beginRestoreFiles.add(req, beginRestoreFiles) + } + + resp, err := server.PollerResponderNext(beginRestoreFiles, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + b.beginRestoreFiles.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRestoreFiles) { + b.beginRestoreFiles.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/backupsundervolume_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/backupsundervolume_server.go new file mode 100644 index 000000000000..ce22cfef441c --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/fake/backupsundervolume_server.go @@ -0,0 +1,127 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" + "net/http" + "net/url" + "regexp" +) + +// BackupsUnderVolumeServer is a fake server for instances of the armnetapp.BackupsUnderVolumeClient type. +type BackupsUnderVolumeServer struct { + // BeginMigrateBackups is the fake for method BackupsUnderVolumeClient.BeginMigrateBackups + // HTTP status codes to indicate success: http.StatusAccepted + BeginMigrateBackups func(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body armnetapp.BackupsMigrationRequest, options *armnetapp.BackupsUnderVolumeClientBeginMigrateBackupsOptions) (resp azfake.PollerResponder[armnetapp.BackupsUnderVolumeClientMigrateBackupsResponse], errResp azfake.ErrorResponder) +} + +// NewBackupsUnderVolumeServerTransport creates a new instance of BackupsUnderVolumeServerTransport with the provided implementation. +// The returned BackupsUnderVolumeServerTransport instance is connected to an instance of armnetapp.BackupsUnderVolumeClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewBackupsUnderVolumeServerTransport(srv *BackupsUnderVolumeServer) *BackupsUnderVolumeServerTransport { + return &BackupsUnderVolumeServerTransport{ + srv: srv, + beginMigrateBackups: newTracker[azfake.PollerResponder[armnetapp.BackupsUnderVolumeClientMigrateBackupsResponse]](), + } +} + +// BackupsUnderVolumeServerTransport connects instances of armnetapp.BackupsUnderVolumeClient to instances of BackupsUnderVolumeServer. +// Don't use this type directly, use NewBackupsUnderVolumeServerTransport instead. +type BackupsUnderVolumeServerTransport struct { + srv *BackupsUnderVolumeServer + beginMigrateBackups *tracker[azfake.PollerResponder[armnetapp.BackupsUnderVolumeClientMigrateBackupsResponse]] +} + +// Do implements the policy.Transporter interface for BackupsUnderVolumeServerTransport. +func (b *BackupsUnderVolumeServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "BackupsUnderVolumeClient.BeginMigrateBackups": + resp, err = b.dispatchBeginMigrateBackups(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (b *BackupsUnderVolumeServerTransport) dispatchBeginMigrateBackups(req *http.Request) (*http.Response, error) { + if b.srv.BeginMigrateBackups == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginMigrateBackups not implemented")} + } + beginMigrateBackups := b.beginMigrateBackups.get(req) + if beginMigrateBackups == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capacityPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/volumes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/migrateBackups` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armnetapp.BackupsMigrationRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + volumeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("volumeName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.BeginMigrateBackups(req.Context(), resourceGroupNameParam, accountNameParam, poolNameParam, volumeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginMigrateBackups = &respr + b.beginMigrateBackups.add(req, beginMigrateBackups) + } + + resp, err := server.PollerResponderNext(beginMigrateBackups, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + b.beginMigrateBackups.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginMigrateBackups) { + b.beginMigrateBackups.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/backupvaults_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/backupvaults_server.go new file mode 100644 index 000000000000..b16df92e5cae --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/fake/backupvaults_server.go @@ -0,0 +1,332 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" + "net/http" + "net/url" + "regexp" +) + +// BackupVaultsServer is a fake server for instances of the armnetapp.BackupVaultsClient type. +type BackupVaultsServer struct { + // BeginCreateOrUpdate is the fake for method BackupVaultsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, body armnetapp.BackupVault, options *armnetapp.BackupVaultsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armnetapp.BackupVaultsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method BackupVaultsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, options *armnetapp.BackupVaultsClientBeginDeleteOptions) (resp azfake.PollerResponder[armnetapp.BackupVaultsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method BackupVaultsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, options *armnetapp.BackupVaultsClientGetOptions) (resp azfake.Responder[armnetapp.BackupVaultsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByNetAppAccountPager is the fake for method BackupVaultsClient.NewListByNetAppAccountPager + // HTTP status codes to indicate success: http.StatusOK + NewListByNetAppAccountPager func(resourceGroupName string, accountName string, options *armnetapp.BackupVaultsClientListByNetAppAccountOptions) (resp azfake.PagerResponder[armnetapp.BackupVaultsClientListByNetAppAccountResponse]) + + // BeginUpdate is the fake for method BackupVaultsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, accountName string, backupVaultName string, body armnetapp.BackupVaultPatch, options *armnetapp.BackupVaultsClientBeginUpdateOptions) (resp azfake.PollerResponder[armnetapp.BackupVaultsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewBackupVaultsServerTransport creates a new instance of BackupVaultsServerTransport with the provided implementation. +// The returned BackupVaultsServerTransport instance is connected to an instance of armnetapp.BackupVaultsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewBackupVaultsServerTransport(srv *BackupVaultsServer) *BackupVaultsServerTransport { + return &BackupVaultsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armnetapp.BackupVaultsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armnetapp.BackupVaultsClientDeleteResponse]](), + newListByNetAppAccountPager: newTracker[azfake.PagerResponder[armnetapp.BackupVaultsClientListByNetAppAccountResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armnetapp.BackupVaultsClientUpdateResponse]](), + } +} + +// BackupVaultsServerTransport connects instances of armnetapp.BackupVaultsClient to instances of BackupVaultsServer. +// Don't use this type directly, use NewBackupVaultsServerTransport instead. +type BackupVaultsServerTransport struct { + srv *BackupVaultsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armnetapp.BackupVaultsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armnetapp.BackupVaultsClientDeleteResponse]] + newListByNetAppAccountPager *tracker[azfake.PagerResponder[armnetapp.BackupVaultsClientListByNetAppAccountResponse]] + beginUpdate *tracker[azfake.PollerResponder[armnetapp.BackupVaultsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for BackupVaultsServerTransport. +func (b *BackupVaultsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "BackupVaultsClient.BeginCreateOrUpdate": + resp, err = b.dispatchBeginCreateOrUpdate(req) + case "BackupVaultsClient.BeginDelete": + resp, err = b.dispatchBeginDelete(req) + case "BackupVaultsClient.Get": + resp, err = b.dispatchGet(req) + case "BackupVaultsClient.NewListByNetAppAccountPager": + resp, err = b.dispatchNewListByNetAppAccountPager(req) + case "BackupVaultsClient.BeginUpdate": + resp, err = b.dispatchBeginUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (b *BackupVaultsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if b.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := b.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armnetapp.BackupVault](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + backupVaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupVaultName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, accountNameParam, backupVaultNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + b.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + b.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + b.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (b *BackupVaultsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if b.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := b.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + backupVaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupVaultName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.BeginDelete(req.Context(), resourceGroupNameParam, accountNameParam, backupVaultNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + b.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + b.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + b.beginDelete.remove(req) + } + + return resp, nil +} + +func (b *BackupVaultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if b.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + backupVaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupVaultName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.Get(req.Context(), resourceGroupNameParam, accountNameParam, backupVaultNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BackupVault, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (b *BackupVaultsServerTransport) dispatchNewListByNetAppAccountPager(req *http.Request) (*http.Response, error) { + if b.srv.NewListByNetAppAccountPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByNetAppAccountPager not implemented")} + } + newListByNetAppAccountPager := b.newListByNetAppAccountPager.get(req) + if newListByNetAppAccountPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupVaults` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + resp := b.srv.NewListByNetAppAccountPager(resourceGroupNameParam, accountNameParam, nil) + newListByNetAppAccountPager = &resp + b.newListByNetAppAccountPager.add(req, newListByNetAppAccountPager) + server.PagerResponderInjectNextLinks(newListByNetAppAccountPager, req, func(page *armnetapp.BackupVaultsClientListByNetAppAccountResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByNetAppAccountPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + b.newListByNetAppAccountPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByNetAppAccountPager) { + b.newListByNetAppAccountPager.remove(req) + } + return resp, nil +} + +func (b *BackupVaultsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if b.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := b.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/backupVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armnetapp.BackupVaultPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + backupVaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("backupVaultName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.BeginUpdate(req.Context(), resourceGroupNameParam, accountNameParam, backupVaultNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + b.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + b.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + b.beginUpdate.remove(req) + } + + return resp, nil +} diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/internal.go b/sdk/resourcemanager/netapp/armnetapp/fake/internal.go index 4d8bd36394ec..7d2f89ba4bb2 100644 --- a/sdk/resourcemanager/netapp/armnetapp/fake/internal.go +++ b/sdk/resourcemanager/netapp/armnetapp/fake/internal.go @@ -11,6 +11,7 @@ package fake import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "net/http" + "reflect" "sync" ) @@ -31,6 +32,13 @@ func contains[T comparable](s []T, v T) bool { return false } +func getOptional[T any](v T) *T { + if reflect.ValueOf(v).IsZero() { + return nil + } + return &v +} + func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { if v == "" { return nil, nil diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/operations_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/operations_server.go index fa477dd78a76..a900fcfd7139 100644 --- a/sdk/resourcemanager/netapp/armnetapp/fake/operations_server.go +++ b/sdk/resourcemanager/netapp/armnetapp/fake/operations_server.go @@ -14,7 +14,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" "net/http" ) diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/pools_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/pools_server.go index 2629235fdfca..2b4637a2a937 100644 --- a/sdk/resourcemanager/netapp/armnetapp/fake/pools_server.go +++ b/sdk/resourcemanager/netapp/armnetapp/fake/pools_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/resource_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/resource_server.go index 92326c2203f6..7941609328f3 100644 --- a/sdk/resourcemanager/netapp/armnetapp/fake/resource_server.go +++ b/sdk/resourcemanager/netapp/armnetapp/fake/resource_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/resourcequotalimits_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/resourcequotalimits_server.go index 295f65740620..693d78b26c5c 100644 --- a/sdk/resourcemanager/netapp/armnetapp/fake/resourcequotalimits_server.go +++ b/sdk/resourcemanager/netapp/armnetapp/fake/resourcequotalimits_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/resourceregioninfos_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/resourceregioninfos_server.go new file mode 100644 index 000000000000..085b0517fa0b --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/fake/resourceregioninfos_server.go @@ -0,0 +1,144 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" + "net/http" + "net/url" + "regexp" +) + +// ResourceRegionInfosServer is a fake server for instances of the armnetapp.ResourceRegionInfosClient type. +type ResourceRegionInfosServer struct { + // Get is the fake for method ResourceRegionInfosClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, location string, options *armnetapp.ResourceRegionInfosClientGetOptions) (resp azfake.Responder[armnetapp.ResourceRegionInfosClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ResourceRegionInfosClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(location string, options *armnetapp.ResourceRegionInfosClientListOptions) (resp azfake.PagerResponder[armnetapp.ResourceRegionInfosClientListResponse]) +} + +// NewResourceRegionInfosServerTransport creates a new instance of ResourceRegionInfosServerTransport with the provided implementation. +// The returned ResourceRegionInfosServerTransport instance is connected to an instance of armnetapp.ResourceRegionInfosClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewResourceRegionInfosServerTransport(srv *ResourceRegionInfosServer) *ResourceRegionInfosServerTransport { + return &ResourceRegionInfosServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armnetapp.ResourceRegionInfosClientListResponse]](), + } +} + +// ResourceRegionInfosServerTransport connects instances of armnetapp.ResourceRegionInfosClient to instances of ResourceRegionInfosServer. +// Don't use this type directly, use NewResourceRegionInfosServerTransport instead. +type ResourceRegionInfosServerTransport struct { + srv *ResourceRegionInfosServer + newListPager *tracker[azfake.PagerResponder[armnetapp.ResourceRegionInfosClientListResponse]] +} + +// Do implements the policy.Transporter interface for ResourceRegionInfosServerTransport. +func (r *ResourceRegionInfosServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ResourceRegionInfosClient.Get": + resp, err = r.dispatchGet(req) + case "ResourceRegionInfosClient.NewListPager": + resp, err = r.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (r *ResourceRegionInfosServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if r.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/regionInfos/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.Get(req.Context(), locationParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RegionInfoResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *ResourceRegionInfosServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if r.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := r.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/regionInfos` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + resp := r.srv.NewListPager(locationParam, nil) + newListPager = &resp + r.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armnetapp.ResourceRegionInfosClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + r.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + r.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/server_factory.go b/sdk/resourcemanager/netapp/armnetapp/fake/server_factory.go index 59dd4cebb237..34a6f5169f11 100644 --- a/sdk/resourcemanager/netapp/armnetapp/fake/server_factory.go +++ b/sdk/resourcemanager/netapp/armnetapp/fake/server_factory.go @@ -19,19 +19,25 @@ import ( // ServerFactory is a fake server for instances of the armnetapp.ClientFactory type. type ServerFactory struct { - AccountsServer AccountsServer - BackupPoliciesServer BackupPoliciesServer - BackupsServer BackupsServer - OperationsServer OperationsServer - PoolsServer PoolsServer - ResourceServer ResourceServer - ResourceQuotaLimitsServer ResourceQuotaLimitsServer - SnapshotPoliciesServer SnapshotPoliciesServer - SnapshotsServer SnapshotsServer - SubvolumesServer SubvolumesServer - VolumeGroupsServer VolumeGroupsServer - VolumeQuotaRulesServer VolumeQuotaRulesServer - VolumesServer VolumesServer + AccountBackupsServer AccountBackupsServer + AccountsServer AccountsServer + BackupPoliciesServer BackupPoliciesServer + BackupVaultsServer BackupVaultsServer + BackupsServer BackupsServer + BackupsUnderAccountServer BackupsUnderAccountServer + BackupsUnderBackupVaultServer BackupsUnderBackupVaultServer + BackupsUnderVolumeServer BackupsUnderVolumeServer + OperationsServer OperationsServer + PoolsServer PoolsServer + ResourceServer ResourceServer + ResourceQuotaLimitsServer ResourceQuotaLimitsServer + ResourceRegionInfosServer ResourceRegionInfosServer + SnapshotPoliciesServer SnapshotPoliciesServer + SnapshotsServer SnapshotsServer + SubvolumesServer SubvolumesServer + VolumeGroupsServer VolumeGroupsServer + VolumeQuotaRulesServer VolumeQuotaRulesServer + VolumesServer VolumesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -46,21 +52,27 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armnetapp.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trAccountsServer *AccountsServerTransport - trBackupPoliciesServer *BackupPoliciesServerTransport - trBackupsServer *BackupsServerTransport - trOperationsServer *OperationsServerTransport - trPoolsServer *PoolsServerTransport - trResourceServer *ResourceServerTransport - trResourceQuotaLimitsServer *ResourceQuotaLimitsServerTransport - trSnapshotPoliciesServer *SnapshotPoliciesServerTransport - trSnapshotsServer *SnapshotsServerTransport - trSubvolumesServer *SubvolumesServerTransport - trVolumeGroupsServer *VolumeGroupsServerTransport - trVolumeQuotaRulesServer *VolumeQuotaRulesServerTransport - trVolumesServer *VolumesServerTransport + srv *ServerFactory + trMu sync.Mutex + trAccountBackupsServer *AccountBackupsServerTransport + trAccountsServer *AccountsServerTransport + trBackupPoliciesServer *BackupPoliciesServerTransport + trBackupVaultsServer *BackupVaultsServerTransport + trBackupsServer *BackupsServerTransport + trBackupsUnderAccountServer *BackupsUnderAccountServerTransport + trBackupsUnderBackupVaultServer *BackupsUnderBackupVaultServerTransport + trBackupsUnderVolumeServer *BackupsUnderVolumeServerTransport + trOperationsServer *OperationsServerTransport + trPoolsServer *PoolsServerTransport + trResourceServer *ResourceServerTransport + trResourceQuotaLimitsServer *ResourceQuotaLimitsServerTransport + trResourceRegionInfosServer *ResourceRegionInfosServerTransport + trSnapshotPoliciesServer *SnapshotPoliciesServerTransport + trSnapshotsServer *SnapshotsServerTransport + trSubvolumesServer *SubvolumesServerTransport + trVolumeGroupsServer *VolumeGroupsServerTransport + trVolumeQuotaRulesServer *VolumeQuotaRulesServerTransport + trVolumesServer *VolumesServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -76,6 +88,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { + case "AccountBackupsClient": + initServer(s, &s.trAccountBackupsServer, func() *AccountBackupsServerTransport { + return NewAccountBackupsServerTransport(&s.srv.AccountBackupsServer) + }) + resp, err = s.trAccountBackupsServer.Do(req) case "AccountsClient": initServer(s, &s.trAccountsServer, func() *AccountsServerTransport { return NewAccountsServerTransport(&s.srv.AccountsServer) }) resp, err = s.trAccountsServer.Do(req) @@ -84,9 +101,27 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewBackupPoliciesServerTransport(&s.srv.BackupPoliciesServer) }) resp, err = s.trBackupPoliciesServer.Do(req) + case "BackupVaultsClient": + initServer(s, &s.trBackupVaultsServer, func() *BackupVaultsServerTransport { return NewBackupVaultsServerTransport(&s.srv.BackupVaultsServer) }) + resp, err = s.trBackupVaultsServer.Do(req) case "BackupsClient": initServer(s, &s.trBackupsServer, func() *BackupsServerTransport { return NewBackupsServerTransport(&s.srv.BackupsServer) }) resp, err = s.trBackupsServer.Do(req) + case "BackupsUnderAccountClient": + initServer(s, &s.trBackupsUnderAccountServer, func() *BackupsUnderAccountServerTransport { + return NewBackupsUnderAccountServerTransport(&s.srv.BackupsUnderAccountServer) + }) + resp, err = s.trBackupsUnderAccountServer.Do(req) + case "BackupsUnderBackupVaultClient": + initServer(s, &s.trBackupsUnderBackupVaultServer, func() *BackupsUnderBackupVaultServerTransport { + return NewBackupsUnderBackupVaultServerTransport(&s.srv.BackupsUnderBackupVaultServer) + }) + resp, err = s.trBackupsUnderBackupVaultServer.Do(req) + case "BackupsUnderVolumeClient": + initServer(s, &s.trBackupsUnderVolumeServer, func() *BackupsUnderVolumeServerTransport { + return NewBackupsUnderVolumeServerTransport(&s.srv.BackupsUnderVolumeServer) + }) + resp, err = s.trBackupsUnderVolumeServer.Do(req) case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) @@ -101,6 +136,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewResourceQuotaLimitsServerTransport(&s.srv.ResourceQuotaLimitsServer) }) resp, err = s.trResourceQuotaLimitsServer.Do(req) + case "ResourceRegionInfosClient": + initServer(s, &s.trResourceRegionInfosServer, func() *ResourceRegionInfosServerTransport { + return NewResourceRegionInfosServerTransport(&s.srv.ResourceRegionInfosServer) + }) + resp, err = s.trResourceRegionInfosServer.Do(req) case "SnapshotPoliciesClient": initServer(s, &s.trSnapshotPoliciesServer, func() *SnapshotPoliciesServerTransport { return NewSnapshotPoliciesServerTransport(&s.srv.SnapshotPoliciesServer) diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/snapshotpolicies_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/snapshotpolicies_server.go index b91de5c31696..f6638372a206 100644 --- a/sdk/resourcemanager/netapp/armnetapp/fake/snapshotpolicies_server.go +++ b/sdk/resourcemanager/netapp/armnetapp/fake/snapshotpolicies_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/snapshots_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/snapshots_server.go index 915d5e181283..fbdfa94330d3 100644 --- a/sdk/resourcemanager/netapp/armnetapp/fake/snapshots_server.go +++ b/sdk/resourcemanager/netapp/armnetapp/fake/snapshots_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/subvolumes_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/subvolumes_server.go index a4e1225ae97b..0dd17f6660af 100644 --- a/sdk/resourcemanager/netapp/armnetapp/fake/subvolumes_server.go +++ b/sdk/resourcemanager/netapp/armnetapp/fake/subvolumes_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/volumegroups_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/volumegroups_server.go index cf7cb061c45c..114bc842aac9 100644 --- a/sdk/resourcemanager/netapp/armnetapp/fake/volumegroups_server.go +++ b/sdk/resourcemanager/netapp/armnetapp/fake/volumegroups_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/volumequotarules_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/volumequotarules_server.go index 3735f70ee2a4..05dbc51f0336 100644 --- a/sdk/resourcemanager/netapp/armnetapp/fake/volumequotarules_server.go +++ b/sdk/resourcemanager/netapp/armnetapp/fake/volumequotarules_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/netapp/armnetapp/fake/volumes_server.go b/sdk/resourcemanager/netapp/armnetapp/fake/volumes_server.go index 623fb68d13f2..97e74bbd4809 100644 --- a/sdk/resourcemanager/netapp/armnetapp/fake/volumes_server.go +++ b/sdk/resourcemanager/netapp/armnetapp/fake/volumes_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" "net/http" "net/url" "reflect" @@ -95,7 +95,7 @@ type VolumesServer struct { ReplicationStatus func(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *armnetapp.VolumesClientReplicationStatusOptions) (resp azfake.Responder[armnetapp.VolumesClientReplicationStatusResponse], errResp azfake.ErrorResponder) // BeginResetCifsPassword is the fake for method VolumesClient.BeginResetCifsPassword - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusAccepted BeginResetCifsPassword func(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *armnetapp.VolumesClientBeginResetCifsPasswordOptions) (resp azfake.PollerResponder[armnetapp.VolumesClientResetCifsPasswordResponse], errResp azfake.ErrorResponder) // BeginResyncReplication is the fake for method VolumesClient.BeginResyncReplication @@ -110,6 +110,10 @@ type VolumesServer struct { // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginRevertRelocation func(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *armnetapp.VolumesClientBeginRevertRelocationOptions) (resp azfake.PollerResponder[armnetapp.VolumesClientRevertRelocationResponse], errResp azfake.ErrorResponder) + // BeginSplitCloneFromParent is the fake for method VolumesClient.BeginSplitCloneFromParent + // HTTP status codes to indicate success: http.StatusAccepted + BeginSplitCloneFromParent func(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *armnetapp.VolumesClientBeginSplitCloneFromParentOptions) (resp azfake.PollerResponder[armnetapp.VolumesClientSplitCloneFromParentResponse], errResp azfake.ErrorResponder) + // BeginUpdate is the fake for method VolumesClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginUpdate func(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body armnetapp.VolumePatch, options *armnetapp.VolumesClientBeginUpdateOptions) (resp azfake.PollerResponder[armnetapp.VolumesClientUpdateResponse], errResp azfake.ErrorResponder) @@ -140,6 +144,7 @@ func NewVolumesServerTransport(srv *VolumesServer) *VolumesServerTransport { beginResyncReplication: newTracker[azfake.PollerResponder[armnetapp.VolumesClientResyncReplicationResponse]](), beginRevert: newTracker[azfake.PollerResponder[armnetapp.VolumesClientRevertResponse]](), beginRevertRelocation: newTracker[azfake.PollerResponder[armnetapp.VolumesClientRevertRelocationResponse]](), + beginSplitCloneFromParent: newTracker[azfake.PollerResponder[armnetapp.VolumesClientSplitCloneFromParentResponse]](), beginUpdate: newTracker[azfake.PollerResponder[armnetapp.VolumesClientUpdateResponse]](), } } @@ -167,6 +172,7 @@ type VolumesServerTransport struct { beginResyncReplication *tracker[azfake.PollerResponder[armnetapp.VolumesClientResyncReplicationResponse]] beginRevert *tracker[azfake.PollerResponder[armnetapp.VolumesClientRevertResponse]] beginRevertRelocation *tracker[azfake.PollerResponder[armnetapp.VolumesClientRevertRelocationResponse]] + beginSplitCloneFromParent *tracker[azfake.PollerResponder[armnetapp.VolumesClientSplitCloneFromParentResponse]] beginUpdate *tracker[azfake.PollerResponder[armnetapp.VolumesClientUpdateResponse]] } @@ -224,6 +230,8 @@ func (v *VolumesServerTransport) Do(req *http.Request) (*http.Response, error) { resp, err = v.dispatchBeginRevert(req) case "VolumesClient.BeginRevertRelocation": resp, err = v.dispatchBeginRevertRelocation(req) + case "VolumesClient.BeginSplitCloneFromParent": + resp, err = v.dispatchBeginSplitCloneFromParent(req) case "VolumesClient.BeginUpdate": resp, err = v.dispatchBeginUpdate(req) default: @@ -1192,9 +1200,9 @@ func (v *VolumesServerTransport) dispatchBeginResetCifsPassword(req *http.Reques return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { v.beginResetCifsPassword.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} } if !server.PollerResponderMore(beginResetCifsPassword) { v.beginResetCifsPassword.remove(req) @@ -1363,6 +1371,58 @@ func (v *VolumesServerTransport) dispatchBeginRevertRelocation(req *http.Request return resp, nil } +func (v *VolumesServerTransport) dispatchBeginSplitCloneFromParent(req *http.Request) (*http.Response, error) { + if v.srv.BeginSplitCloneFromParent == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginSplitCloneFromParent not implemented")} + } + beginSplitCloneFromParent := v.beginSplitCloneFromParent.get(req) + if beginSplitCloneFromParent == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.NetApp/netAppAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capacityPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/volumes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/splitCloneFromParent` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + accountNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("accountName")]) + if err != nil { + return nil, err + } + poolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("poolName")]) + if err != nil { + return nil, err + } + volumeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("volumeName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginSplitCloneFromParent(req.Context(), resourceGroupNameParam, accountNameParam, poolNameParam, volumeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginSplitCloneFromParent = &respr + v.beginSplitCloneFromParent.add(req, beginSplitCloneFromParent) + } + + resp, err := server.PollerResponderNext(beginSplitCloneFromParent, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + v.beginSplitCloneFromParent.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginSplitCloneFromParent) { + v.beginSplitCloneFromParent.remove(req) + } + + return resp, nil +} + func (v *VolumesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { if v.srv.BeginUpdate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} diff --git a/sdk/resourcemanager/netapp/armnetapp/go.mod b/sdk/resourcemanager/netapp/armnetapp/go.mod index 1054893ac71b..2b74b860398f 100644 --- a/sdk/resourcemanager/netapp/armnetapp/go.mod +++ b/sdk/resourcemanager/netapp/armnetapp/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v5 +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6 go 1.18 diff --git a/sdk/resourcemanager/netapp/armnetapp/models.go b/sdk/resourcemanager/netapp/armnetapp/models.go index 35632f748679..5e261437e3ae 100644 --- a/sdk/resourcemanager/netapp/armnetapp/models.go +++ b/sdk/resourcemanager/netapp/armnetapp/models.go @@ -27,7 +27,7 @@ type Account struct { // READ-ONLY; A unique read-only string that changes whenever the resource is updated. Etag *string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource @@ -93,9 +93,16 @@ type AccountProperties struct { // Encryption settings Encryption *AccountEncryption + // Domain for NFSv4 user ID mapping. This property will be set for all NetApp accounts in the subscription and region and + // only affect non ldap NFSv4 volumes. + NfsV4IDDomain *string + // READ-ONLY; Shows the status of disableShowmount for all volumes under the subscription, null equals false DisableShowmount *bool + // READ-ONLY; This will have true value only if account is Multiple AD enabled. + IsMultiAdEnabled *bool + // READ-ONLY; Azure lifecycle management ProvisioningState *string } @@ -183,6 +190,36 @@ type AuthorizeRequest struct { RemoteVolumeResourceID *string } +// Backup under a Backup Vault +type Backup struct { + // REQUIRED; Backup Properties + Properties *BackupProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// BackupPatch - Backup patch +type BackupPatch struct { + // Backup Patch Properties + Properties *BackupPatchProperties +} + +// BackupPatchProperties - Backup patch properties +type BackupPatchProperties struct { + // Label for backup + Label *string +} + // BackupPoliciesList - List of Backup Policies type BackupPoliciesList struct { // A list of backup policies @@ -203,7 +240,7 @@ type BackupPolicy struct { // READ-ONLY; A unique read-only string that changes whenever the resource is updated. Etag *string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource @@ -264,6 +301,146 @@ type BackupPolicyProperties struct { VolumesAssigned *int32 } +// BackupProperties - Backup properties +type BackupProperties struct { + // REQUIRED; ResourceId used to identify the Volume + VolumeResourceID *string + + // Label for backup + Label *string + + // The name of the snapshot + SnapshotName *string + + // Manual backup an already existing snapshot. This will always be false for scheduled backups and true/false for manual backups + UseExistingSnapshot *bool + + // READ-ONLY; UUID v4 used to identify the Backup + BackupID *string + + // READ-ONLY; ResourceId used to identify the backup policy + BackupPolicyResourceID *string + + // READ-ONLY; Type of backup Manual or Scheduled + BackupType *BackupType + + // READ-ONLY; The creation date of the backup + CreationDate *time.Time + + // READ-ONLY; Failure reason + FailureReason *string + + // READ-ONLY; Azure lifecycle management + ProvisioningState *string + + // READ-ONLY; Size of backup in bytes + Size *int64 +} + +// BackupRestoreFiles - Restore payload for Single File Backup Restore +type BackupRestoreFiles struct { + // REQUIRED; Resource Id of the destination volume on which the files need to be restored + DestinationVolumeID *string + + // REQUIRED; List of files to be restored + FileList []*string + + // Destination folder where the files will be restored. The path name should start with a forward slash. If it is omitted + // from request then restore is done at the root folder of the destination volume by + // default + RestoreFilePath *string +} + +// BackupStatus - Backup status +type BackupStatus struct { + // READ-ONLY; Displays error message if the backup is in an error state + ErrorMessage *string + + // READ-ONLY; Backup health status + Healthy *bool + + // READ-ONLY; Displays the last transfer size + LastTransferSize *int64 + + // READ-ONLY; Displays the last transfer type + LastTransferType *string + + // READ-ONLY; The status of the backup + MirrorState *MirrorState + + // READ-ONLY; Status of the backup mirror relationship + RelationshipStatus *RelationshipStatus + + // READ-ONLY; Displays the total bytes transferred + TotalTransferBytes *int64 + + // READ-ONLY; Displays the total number of bytes transferred for the ongoing operation + TransferProgressBytes *int64 + + // READ-ONLY; Reason for the unhealthy backup relationship + UnhealthyReason *string +} + +// BackupVault - Backup Vault information +type BackupVault struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // Backup Vault Properties + Properties *BackupVaultProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// BackupVaultPatch - Backup Vault information +type BackupVaultPatch struct { + // Resource tags + Tags map[string]*string +} + +// BackupVaultProperties - Backup Vault properties +type BackupVaultProperties struct { + // READ-ONLY; Azure lifecycle management + ProvisioningState *string +} + +// BackupVaultsList - List of Backup Vaults +type BackupVaultsList struct { + // URL to get the next set of results. + NextLink *string + + // A list of Backup Vaults + Value []*BackupVault +} + +// BackupsList - List of Backups +type BackupsList struct { + // URL to get the next set of results. + NextLink *string + + // A list of Backups + Value []*Backup +} + +// BackupsMigrationRequest - Migrate Backups Request +type BackupsMigrationRequest struct { + // REQUIRED; The ResourceId of the Backup Vault + BackupVaultID *string +} + // BreakFileLocksRequest - Break file locks request type BreakFileLocksRequest struct { // To clear file locks on a volume for a particular client @@ -294,7 +471,7 @@ type CapacityPool struct { // READ-ONLY; A unique read-only string that changes whenever the resource is updated. Etag *string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource @@ -386,6 +563,15 @@ type EncryptionIdentity struct { PrincipalID *string } +// EncryptionMigrationRequest - Encryption migration request +type EncryptionMigrationRequest struct { + // REQUIRED; Identifier of the private endpoint to reach the Azure Key Vault + PrivateEndpointID *string + + // REQUIRED; Identifier for the virtual network + VirtualNetworkID *string +} + // ExportPolicyRule - Volume Export Policy Rule type ExportPolicyRule struct { // Client ingress specification as comma separated string with IPv4 CIDRs, IPv4 host addresses and host names @@ -795,12 +981,51 @@ type RegionInfoAvailabilityZoneMappingsItem struct { IsAvailable *bool } +// RegionInfoResource - Information regarding regionInfo Item. +type RegionInfoResource struct { + // regionInfo properties + Properties *RegionInfo + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// RegionInfosList - List of regionInfo resources +type RegionInfosList struct { + // URL to get the next set of results. + NextLink *string + + // A list of regionInfo resources + Value []*RegionInfoResource +} + // RelocateVolumeRequest - Relocate volume request type RelocateVolumeRequest struct { // New creation token for the volume that controls the mount point name CreationToken *string } +// RemotePath - The full path to a volume that is to be migrated into ANF. Required for Migration volumes +type RemotePath struct { + // REQUIRED; The Path to a Ontap Host + ExternalHostName *string + + // REQUIRED; The name of a server on the Ontap Host + ServerName *string + + // REQUIRED; The name of a volume on the server + VolumeName *string +} + // Replication properties type Replication struct { // REQUIRED; The resource ID of the remote volume. @@ -818,12 +1043,15 @@ type Replication struct { // ReplicationObject - Replication properties type ReplicationObject struct { - // REQUIRED; The resource ID of the remote volume. + // REQUIRED; The resource ID of the remote volume. Required for cross region and cross zone replication RemoteVolumeResourceID *string // Indicates whether the local volume is the source or destination for the Volume Replication EndpointType *EndpointType + // The full path to a volume that is to be migrated into ANF. Required for Migration volumes + RemotePath *RemotePath + // The remote region for the other end of the Volume Replication. RemoteVolumeRegion *string @@ -902,7 +1130,7 @@ type Snapshot struct { // Snapshot Properties Properties *SnapshotProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource @@ -935,7 +1163,7 @@ type SnapshotPolicy struct { // READ-ONLY; A unique read-only string that changes whenever the resource is updated. Etag *string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource @@ -1028,7 +1256,7 @@ type SubscriptionQuotaItem struct { // SubscriptionQuotaItem properties Properties *SubscriptionQuotaItemProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource @@ -1061,7 +1289,7 @@ type SubvolumeInfo struct { // Subvolume Properties Properties *SubvolumeProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource @@ -1184,7 +1412,7 @@ type SystemData struct { // UpdateNetworkSiblingSetRequest - Network sibling set update. type UpdateNetworkSiblingSetRequest struct { - // REQUIRED; Network features available to the volume, some such + // REQUIRED; Network features available to the volume NetworkFeatures *NetworkFeatures // REQUIRED; Network Sibling Set ID for a group of volumes sharing networking resources in a subnet. @@ -1224,7 +1452,7 @@ type Volume struct { // READ-ONLY; A unique read-only string that changes whenever the resource is updated. Etag *string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource @@ -1237,6 +1465,21 @@ type Volume struct { Type *string } +// VolumeBackupProperties - Volume Backup Properties +type VolumeBackupProperties struct { + // Backup Enabled + BackupEnabled *bool + + // Backup Policy Resource ID + BackupPolicyID *string + + // Backup Vault Resource ID + BackupVaultID *string + + // Policy Enforced + PolicyEnforced *bool +} + // VolumeBackups - Volume details using the backup policy type VolumeBackups struct { // Total count of backups for volume @@ -1308,9 +1551,6 @@ type VolumeGroupMetaData struct { // Application Type ApplicationType *ApplicationType - // Application specific identifier of deployment rules for the volume group - DeploymentSpecID *string - // Application specific placement rules for the volume group GlobalPlacementRules []*PlacementKeyValuePairs @@ -1446,6 +1686,9 @@ type VolumePatchProperties struct { // VolumePatchPropertiesDataProtection - DataProtection type volumes include an object containing details of the replication type VolumePatchPropertiesDataProtection struct { + // Backup Properties + Backup *VolumeBackupProperties + // Snapshot properties. Snapshot *VolumeSnapshotProperties } @@ -1587,7 +1830,8 @@ type VolumeProperties struct { // e.g. data, log VolumeSpecName *string - // What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection + // What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. For creating + // clone volume, set type to ShortTermClone VolumeType *string // READ-ONLY; Actual throughput in MiB/s for auto qosType volumes calculated based on size and serviceLevel @@ -1614,6 +1858,9 @@ type VolumeProperties struct { // READ-ONLY; Unique FileSystem Identifier. FileSystemID *string + // READ-ONLY; Space shared by short term clone volume with parent volume in bytes. + InheritedSizeInBytes *int64 + // READ-ONLY; Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed // if volume quota is more than 4TiB. MaximumNumberOfFiles *int64 @@ -1646,6 +1893,9 @@ type VolumeProperties struct { // VolumePropertiesDataProtection - DataProtection type volumes include an object containing details of the replication type VolumePropertiesDataProtection struct { + // Backup Properties + Backup *VolumeBackupProperties + // Replication properties Replication *ReplicationObject @@ -1673,7 +1923,7 @@ type VolumeQuotaRule struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource diff --git a/sdk/resourcemanager/netapp/armnetapp/models_serde.go b/sdk/resourcemanager/netapp/armnetapp/models_serde.go index c73457f5d6c9..3a4057d0424e 100644 --- a/sdk/resourcemanager/netapp/armnetapp/models_serde.go +++ b/sdk/resourcemanager/netapp/armnetapp/models_serde.go @@ -197,6 +197,8 @@ func (a AccountProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "activeDirectories", a.ActiveDirectories) populate(objectMap, "disableShowmount", a.DisableShowmount) populate(objectMap, "encryption", a.Encryption) + populate(objectMap, "isMultiAdEnabled", a.IsMultiAdEnabled) + populate(objectMap, "nfsV4IDDomain", a.NfsV4IDDomain) populate(objectMap, "provisioningState", a.ProvisioningState) return json.Marshal(objectMap) } @@ -219,6 +221,12 @@ func (a *AccountProperties) UnmarshalJSON(data []byte) error { case "encryption": err = unpopulate(val, "Encryption", &a.Encryption) delete(rawMsg, key) + case "isMultiAdEnabled": + err = unpopulate(val, "IsMultiAdEnabled", &a.IsMultiAdEnabled) + delete(rawMsg, key) + case "nfsV4IDDomain": + err = unpopulate(val, "NfsV4IDDomain", &a.NfsV4IDDomain) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) delete(rawMsg, key) @@ -372,6 +380,103 @@ func (a *AuthorizeRequest) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Backup. +func (b Backup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Backup. +func (b *Backup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &b.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupPatch. +func (b BackupPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", b.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupPatch. +func (b *BackupPatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupPatchProperties. +func (b BackupPatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "label", b.Label) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupPatchProperties. +func (b *BackupPatchProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "label": + err = unpopulate(val, "Label", &b.Label) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type BackupPoliciesList. func (b BackupPoliciesList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -556,6 +661,361 @@ func (b *BackupPolicyProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type BackupProperties. +func (b BackupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupId", b.BackupID) + populate(objectMap, "backupPolicyResourceId", b.BackupPolicyResourceID) + populate(objectMap, "backupType", b.BackupType) + populateDateTimeRFC3339(objectMap, "creationDate", b.CreationDate) + populate(objectMap, "failureReason", b.FailureReason) + populate(objectMap, "label", b.Label) + populate(objectMap, "provisioningState", b.ProvisioningState) + populate(objectMap, "size", b.Size) + populate(objectMap, "snapshotName", b.SnapshotName) + populate(objectMap, "useExistingSnapshot", b.UseExistingSnapshot) + populate(objectMap, "volumeResourceId", b.VolumeResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupProperties. +func (b *BackupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupId": + err = unpopulate(val, "BackupID", &b.BackupID) + delete(rawMsg, key) + case "backupPolicyResourceId": + err = unpopulate(val, "BackupPolicyResourceID", &b.BackupPolicyResourceID) + delete(rawMsg, key) + case "backupType": + err = unpopulate(val, "BackupType", &b.BackupType) + delete(rawMsg, key) + case "creationDate": + err = unpopulateDateTimeRFC3339(val, "CreationDate", &b.CreationDate) + delete(rawMsg, key) + case "failureReason": + err = unpopulate(val, "FailureReason", &b.FailureReason) + delete(rawMsg, key) + case "label": + err = unpopulate(val, "Label", &b.Label) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &b.ProvisioningState) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &b.Size) + delete(rawMsg, key) + case "snapshotName": + err = unpopulate(val, "SnapshotName", &b.SnapshotName) + delete(rawMsg, key) + case "useExistingSnapshot": + err = unpopulate(val, "UseExistingSnapshot", &b.UseExistingSnapshot) + delete(rawMsg, key) + case "volumeResourceId": + err = unpopulate(val, "VolumeResourceID", &b.VolumeResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupRestoreFiles. +func (b BackupRestoreFiles) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destinationVolumeId", b.DestinationVolumeID) + populate(objectMap, "fileList", b.FileList) + populate(objectMap, "restoreFilePath", b.RestoreFilePath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupRestoreFiles. +func (b *BackupRestoreFiles) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationVolumeId": + err = unpopulate(val, "DestinationVolumeID", &b.DestinationVolumeID) + delete(rawMsg, key) + case "fileList": + err = unpopulate(val, "FileList", &b.FileList) + delete(rawMsg, key) + case "restoreFilePath": + err = unpopulate(val, "RestoreFilePath", &b.RestoreFilePath) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupStatus. +func (b BackupStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errorMessage", b.ErrorMessage) + populate(objectMap, "healthy", b.Healthy) + populate(objectMap, "lastTransferSize", b.LastTransferSize) + populate(objectMap, "lastTransferType", b.LastTransferType) + populate(objectMap, "mirrorState", b.MirrorState) + populate(objectMap, "relationshipStatus", b.RelationshipStatus) + populate(objectMap, "totalTransferBytes", b.TotalTransferBytes) + populate(objectMap, "transferProgressBytes", b.TransferProgressBytes) + populate(objectMap, "unhealthyReason", b.UnhealthyReason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupStatus. +func (b *BackupStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &b.ErrorMessage) + delete(rawMsg, key) + case "healthy": + err = unpopulate(val, "Healthy", &b.Healthy) + delete(rawMsg, key) + case "lastTransferSize": + err = unpopulate(val, "LastTransferSize", &b.LastTransferSize) + delete(rawMsg, key) + case "lastTransferType": + err = unpopulate(val, "LastTransferType", &b.LastTransferType) + delete(rawMsg, key) + case "mirrorState": + err = unpopulate(val, "MirrorState", &b.MirrorState) + delete(rawMsg, key) + case "relationshipStatus": + err = unpopulate(val, "RelationshipStatus", &b.RelationshipStatus) + delete(rawMsg, key) + case "totalTransferBytes": + err = unpopulate(val, "TotalTransferBytes", &b.TotalTransferBytes) + delete(rawMsg, key) + case "transferProgressBytes": + err = unpopulate(val, "TransferProgressBytes", &b.TransferProgressBytes) + delete(rawMsg, key) + case "unhealthyReason": + err = unpopulate(val, "UnhealthyReason", &b.UnhealthyReason) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupVault. +func (b BackupVault) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", b.ID) + populate(objectMap, "location", b.Location) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "tags", b.Tags) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupVault. +func (b *BackupVault) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &b.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &b.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &b.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupVaultPatch. +func (b BackupVaultPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", b.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupVaultPatch. +func (b *BackupVaultPatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &b.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupVaultProperties. +func (b BackupVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", b.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupVaultProperties. +func (b *BackupVaultProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &b.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupVaultsList. +func (b BackupVaultsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupVaultsList. +func (b *BackupVaultsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupsList. +func (b BackupsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupsList. +func (b *BackupsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupsMigrationRequest. +func (b BackupsMigrationRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupVaultId", b.BackupVaultID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupsMigrationRequest. +func (b *BackupsMigrationRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupVaultId": + err = unpopulate(val, "BackupVaultID", &b.BackupVaultID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type BreakFileLocksRequest. func (b BreakFileLocksRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -883,6 +1343,37 @@ func (e *EncryptionIdentity) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type EncryptionMigrationRequest. +func (e EncryptionMigrationRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpointId", e.PrivateEndpointID) + populate(objectMap, "virtualNetworkId", e.VirtualNetworkID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionMigrationRequest. +func (e *EncryptionMigrationRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpointId": + err = unpopulate(val, "PrivateEndpointID", &e.PrivateEndpointID) + delete(rawMsg, key) + case "virtualNetworkId": + err = unpopulate(val, "VirtualNetworkID", &e.VirtualNetworkID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ExportPolicyRule. func (e ExportPolicyRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1947,6 +2438,80 @@ func (r *RegionInfoAvailabilityZoneMappingsItem) UnmarshalJSON(data []byte) erro return nil } +// MarshalJSON implements the json.Marshaller interface for type RegionInfoResource. +func (r RegionInfoResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegionInfoResource. +func (r *RegionInfoResource) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegionInfosList. +func (r RegionInfosList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegionInfosList. +func (r *RegionInfosList) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type RelocateVolumeRequest. func (r RelocateVolumeRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1974,6 +2539,41 @@ func (r *RelocateVolumeRequest) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type RemotePath. +func (r RemotePath) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "externalHostName", r.ExternalHostName) + populate(objectMap, "serverName", r.ServerName) + populate(objectMap, "volumeName", r.VolumeName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RemotePath. +func (r *RemotePath) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "externalHostName": + err = unpopulate(val, "ExternalHostName", &r.ExternalHostName) + delete(rawMsg, key) + case "serverName": + err = unpopulate(val, "ServerName", &r.ServerName) + delete(rawMsg, key) + case "volumeName": + err = unpopulate(val, "VolumeName", &r.VolumeName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Replication. func (r Replication) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2017,6 +2617,7 @@ func (r *Replication) UnmarshalJSON(data []byte) error { func (r ReplicationObject) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "endpointType", r.EndpointType) + populate(objectMap, "remotePath", r.RemotePath) populate(objectMap, "remoteVolumeRegion", r.RemoteVolumeRegion) populate(objectMap, "remoteVolumeResourceId", r.RemoteVolumeResourceID) populate(objectMap, "replicationId", r.ReplicationID) @@ -2036,6 +2637,9 @@ func (r *ReplicationObject) UnmarshalJSON(data []byte) error { case "endpointType": err = unpopulate(val, "EndpointType", &r.EndpointType) delete(rawMsg, key) + case "remotePath": + err = unpopulate(val, "RemotePath", &r.RemotePath) + delete(rawMsg, key) case "remoteVolumeRegion": err = unpopulate(val, "RemoteVolumeRegion", &r.RemoteVolumeRegion) delete(rawMsg, key) @@ -3105,6 +3709,45 @@ func (v *Volume) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type VolumeBackupProperties. +func (v VolumeBackupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupEnabled", v.BackupEnabled) + populate(objectMap, "backupPolicyId", v.BackupPolicyID) + populate(objectMap, "backupVaultId", v.BackupVaultID) + populate(objectMap, "policyEnforced", v.PolicyEnforced) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VolumeBackupProperties. +func (v *VolumeBackupProperties) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupEnabled": + err = unpopulate(val, "BackupEnabled", &v.BackupEnabled) + delete(rawMsg, key) + case "backupPolicyId": + err = unpopulate(val, "BackupPolicyID", &v.BackupPolicyID) + delete(rawMsg, key) + case "backupVaultId": + err = unpopulate(val, "BackupVaultID", &v.BackupVaultID) + delete(rawMsg, key) + case "policyEnforced": + err = unpopulate(val, "PolicyEnforced", &v.PolicyEnforced) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type VolumeBackups. func (v VolumeBackups) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3289,7 +3932,6 @@ func (v VolumeGroupMetaData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "applicationIdentifier", v.ApplicationIdentifier) populate(objectMap, "applicationType", v.ApplicationType) - populate(objectMap, "deploymentSpecId", v.DeploymentSpecID) populate(objectMap, "globalPlacementRules", v.GlobalPlacementRules) populate(objectMap, "groupDescription", v.GroupDescription) populate(objectMap, "volumesCount", v.VolumesCount) @@ -3311,9 +3953,6 @@ func (v *VolumeGroupMetaData) UnmarshalJSON(data []byte) error { case "applicationType": err = unpopulate(val, "ApplicationType", &v.ApplicationType) delete(rawMsg, key) - case "deploymentSpecId": - err = unpopulate(val, "DeploymentSpecID", &v.DeploymentSpecID) - delete(rawMsg, key) case "globalPlacementRules": err = unpopulate(val, "GlobalPlacementRules", &v.GlobalPlacementRules) delete(rawMsg, key) @@ -3577,6 +4216,7 @@ func (v *VolumePatchProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VolumePatchPropertiesDataProtection. func (v VolumePatchPropertiesDataProtection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "backup", v.Backup) populate(objectMap, "snapshot", v.Snapshot) return json.Marshal(objectMap) } @@ -3590,6 +4230,9 @@ func (v *VolumePatchPropertiesDataProtection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "backup": + err = unpopulate(val, "Backup", &v.Backup) + delete(rawMsg, key) case "snapshot": err = unpopulate(val, "Snapshot", &v.Snapshot) delete(rawMsg, key) @@ -3652,6 +4295,7 @@ func (v VolumeProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "exportPolicy", v.ExportPolicy) populate(objectMap, "fileAccessLogs", v.FileAccessLogs) populate(objectMap, "fileSystemId", v.FileSystemID) + populate(objectMap, "inheritedSizeInBytes", v.InheritedSizeInBytes) populate(objectMap, "isDefaultQuotaEnabled", v.IsDefaultQuotaEnabled) populate(objectMap, "isLargeVolume", v.IsLargeVolume) populate(objectMap, "isRestoring", v.IsRestoring) @@ -3760,6 +4404,9 @@ func (v *VolumeProperties) UnmarshalJSON(data []byte) error { case "fileSystemId": err = unpopulate(val, "FileSystemID", &v.FileSystemID) delete(rawMsg, key) + case "inheritedSizeInBytes": + err = unpopulate(val, "InheritedSizeInBytes", &v.InheritedSizeInBytes) + delete(rawMsg, key) case "isDefaultQuotaEnabled": err = unpopulate(val, "IsDefaultQuotaEnabled", &v.IsDefaultQuotaEnabled) delete(rawMsg, key) @@ -3870,6 +4517,7 @@ func (v *VolumeProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VolumePropertiesDataProtection. func (v VolumePropertiesDataProtection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "backup", v.Backup) populate(objectMap, "replication", v.Replication) populate(objectMap, "snapshot", v.Snapshot) populate(objectMap, "volumeRelocation", v.VolumeRelocation) @@ -3885,6 +4533,9 @@ func (v *VolumePropertiesDataProtection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "backup": + err = unpopulate(val, "Backup", &v.Backup) + delete(rawMsg, key) case "replication": err = unpopulate(val, "Replication", &v.Replication) delete(rawMsg, key) diff --git a/sdk/resourcemanager/netapp/armnetapp/operations_client.go b/sdk/resourcemanager/netapp/armnetapp/operations_client.go index 99093fce43fc..a5cba7712eec 100644 --- a/sdk/resourcemanager/netapp/armnetapp/operations_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available Microsoft.NetApp Rest API operations // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -73,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/netapp/armnetapp/operations_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/operations_client_example_test.go index 51c4525e40ad..b3be15b07774 100644 --- a/sdk/resourcemanager/netapp/armnetapp/operations_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/operations_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/OperationList.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/OperationList.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/options.go b/sdk/resourcemanager/netapp/armnetapp/options.go index 1bc240ccd04c..572f165061f6 100644 --- a/sdk/resourcemanager/netapp/armnetapp/options.go +++ b/sdk/resourcemanager/netapp/armnetapp/options.go @@ -8,6 +8,24 @@ package armnetapp +// AccountBackupsClientBeginDeleteOptions contains the optional parameters for the AccountBackupsClient.BeginDelete method. +type AccountBackupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AccountBackupsClientGetOptions contains the optional parameters for the AccountBackupsClient.Get method. +type AccountBackupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AccountBackupsClientListByNetAppAccountOptions contains the optional parameters for the AccountBackupsClient.NewListByNetAppAccountPager +// method. +type AccountBackupsClientListByNetAppAccountOptions struct { + // An option to specify whether to return backups only from deleted volumes + IncludeOnlyBackupsFromDeletedVolumes *string +} + // AccountsClientBeginCreateOrUpdateOptions contains the optional parameters for the AccountsClient.BeginCreateOrUpdate method. type AccountsClientBeginCreateOrUpdateOptions struct { // Resumes the LRO from the provided token. @@ -20,6 +38,16 @@ type AccountsClientBeginDeleteOptions struct { ResumeToken string } +// AccountsClientBeginMigrateEncryptionKeyOptions contains the optional parameters for the AccountsClient.BeginMigrateEncryptionKey +// method. +type AccountsClientBeginMigrateEncryptionKeyOptions struct { + // The required parameters to perform encryption migration. + Body *EncryptionMigrationRequest + + // Resumes the LRO from the provided token. + ResumeToken string +} + // AccountsClientBeginRenewCredentialsOptions contains the optional parameters for the AccountsClient.BeginRenewCredentials // method. type AccountsClientBeginRenewCredentialsOptions struct { @@ -77,12 +105,97 @@ type BackupPoliciesClientListOptions struct { // placeholder for future optional parameters } +// BackupVaultsClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupVaultsClient.BeginCreateOrUpdate +// method. +type BackupVaultsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupVaultsClientBeginDeleteOptions contains the optional parameters for the BackupVaultsClient.BeginDelete method. +type BackupVaultsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupVaultsClientBeginUpdateOptions contains the optional parameters for the BackupVaultsClient.BeginUpdate method. +type BackupVaultsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupVaultsClientGetOptions contains the optional parameters for the BackupVaultsClient.Get method. +type BackupVaultsClientGetOptions struct { + // placeholder for future optional parameters +} + +// BackupVaultsClientListByNetAppAccountOptions contains the optional parameters for the BackupVaultsClient.NewListByNetAppAccountPager +// method. +type BackupVaultsClientListByNetAppAccountOptions struct { + // placeholder for future optional parameters +} + +// BackupsClientBeginCreateOptions contains the optional parameters for the BackupsClient.BeginCreate method. +type BackupsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupsClientBeginDeleteOptions contains the optional parameters for the BackupsClient.BeginDelete method. +type BackupsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupsClientBeginUpdateOptions contains the optional parameters for the BackupsClient.BeginUpdate method. +type BackupsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupsClientGetLatestStatusOptions contains the optional parameters for the BackupsClient.GetLatestStatus method. +type BackupsClientGetLatestStatusOptions struct { + // placeholder for future optional parameters +} + +// BackupsClientGetOptions contains the optional parameters for the BackupsClient.Get method. +type BackupsClientGetOptions struct { + // placeholder for future optional parameters +} + // BackupsClientGetVolumeRestoreStatusOptions contains the optional parameters for the BackupsClient.GetVolumeRestoreStatus // method. type BackupsClientGetVolumeRestoreStatusOptions struct { // placeholder for future optional parameters } +// BackupsClientListByVaultOptions contains the optional parameters for the BackupsClient.NewListByVaultPager method. +type BackupsClientListByVaultOptions struct { + // An option to specify the VolumeResourceId. If present, then only returns the backups under the specified volume + Filter *string +} + +// BackupsUnderAccountClientBeginMigrateBackupsOptions contains the optional parameters for the BackupsUnderAccountClient.BeginMigrateBackups +// method. +type BackupsUnderAccountClientBeginMigrateBackupsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupsUnderBackupVaultClientBeginRestoreFilesOptions contains the optional parameters for the BackupsUnderBackupVaultClient.BeginRestoreFiles +// method. +type BackupsUnderBackupVaultClientBeginRestoreFilesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupsUnderVolumeClientBeginMigrateBackupsOptions contains the optional parameters for the BackupsUnderVolumeClient.BeginMigrateBackups +// method. +type BackupsUnderVolumeClientBeginMigrateBackupsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters @@ -162,6 +275,16 @@ type ResourceQuotaLimitsClientListOptions struct { // placeholder for future optional parameters } +// ResourceRegionInfosClientGetOptions contains the optional parameters for the ResourceRegionInfosClient.Get method. +type ResourceRegionInfosClientGetOptions struct { + // placeholder for future optional parameters +} + +// ResourceRegionInfosClientListOptions contains the optional parameters for the ResourceRegionInfosClient.NewListPager method. +type ResourceRegionInfosClientListOptions struct { + // placeholder for future optional parameters +} + // SnapshotPoliciesClientBeginDeleteOptions contains the optional parameters for the SnapshotPoliciesClient.BeginDelete method. type SnapshotPoliciesClientBeginDeleteOptions struct { // Resumes the LRO from the provided token. @@ -439,6 +562,13 @@ type VolumesClientBeginRevertRelocationOptions struct { ResumeToken string } +// VolumesClientBeginSplitCloneFromParentOptions contains the optional parameters for the VolumesClient.BeginSplitCloneFromParent +// method. +type VolumesClientBeginSplitCloneFromParentOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // VolumesClientBeginUpdateOptions contains the optional parameters for the VolumesClient.BeginUpdate method. type VolumesClientBeginUpdateOptions struct { // Resumes the LRO from the provided token. diff --git a/sdk/resourcemanager/netapp/armnetapp/pools_client.go b/sdk/resourcemanager/netapp/armnetapp/pools_client.go index b4b15ff53ccc..6caf17db48f4 100644 --- a/sdk/resourcemanager/netapp/armnetapp/pools_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/pools_client.go @@ -28,7 +28,7 @@ type PoolsClient struct { } // NewPoolsClient creates a new instance of PoolsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PoolsClient, error) { @@ -46,7 +46,7 @@ func NewPoolsClient(subscriptionID string, credential azcore.TokenCredential, op // BeginCreateOrUpdate - Create or Update a capacity pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -74,7 +74,7 @@ func (client *PoolsClient) BeginCreateOrUpdate(ctx context.Context, resourceGrou // CreateOrUpdate - Create or Update a capacity pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *PoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, poolName string, body CapacityPool, options *PoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PoolsClient.BeginCreateOrUpdate" @@ -120,7 +120,7 @@ func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -132,7 +132,7 @@ func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, reso // BeginDelete - Delete the specified capacity pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -158,7 +158,7 @@ func (client *PoolsClient) BeginDelete(ctx context.Context, resourceGroupName st // Delete - Delete the specified capacity pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *PoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, poolName string, options *PoolsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PoolsClient.BeginDelete" @@ -204,7 +204,7 @@ func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -212,7 +212,7 @@ func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGrou // Get - Get details of the specified capacity pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -263,7 +263,7 @@ func (client *PoolsClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +280,7 @@ func (client *PoolsClient) getHandleResponse(resp *http.Response) (PoolsClientGe // NewListPager - List all capacity pools in the NetApp Account // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - options - PoolsClientListOptions contains the optional parameters for the PoolsClient.NewListPager method. @@ -327,7 +327,7 @@ func (client *PoolsClient) listCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -345,7 +345,7 @@ func (client *PoolsClient) listHandleResponse(resp *http.Response) (PoolsClientL // BeginUpdate - Patch the specified capacity pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -372,7 +372,7 @@ func (client *PoolsClient) BeginUpdate(ctx context.Context, resourceGroupName st // Update - Patch the specified capacity pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *PoolsClient) update(ctx context.Context, resourceGroupName string, accountName string, poolName string, body CapacityPoolPatch, options *PoolsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "PoolsClient.BeginUpdate" @@ -418,7 +418,7 @@ func (client *PoolsClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/pools_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/pools_client_example_test.go index f4bdec8b8d9e..c7ae429fb8ff 100644 --- a/sdk/resourcemanager/netapp/armnetapp/pools_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/pools_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Pools_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Pools_List.json func ExamplePoolsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -60,7 +60,7 @@ func ExamplePoolsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Pools_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Pools_Get.json func ExamplePoolsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -95,7 +95,7 @@ func ExamplePoolsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Pools_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Pools_CreateOrUpdate.json func ExamplePoolsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -140,7 +140,7 @@ func ExamplePoolsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Pools_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Pools_Update.json func ExamplePoolsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -179,7 +179,7 @@ func ExamplePoolsClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Pools_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Pools_Delete.json func ExamplePoolsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/resource_client.go b/sdk/resourcemanager/netapp/armnetapp/resource_client.go index 63b8420ab4ac..0a5d66948fb6 100644 --- a/sdk/resourcemanager/netapp/armnetapp/resource_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/resource_client.go @@ -28,7 +28,7 @@ type ResourceClient struct { } // NewResourceClient creates a new instance of ResourceClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewResourceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceClient, error) { @@ -46,8 +46,8 @@ func NewResourceClient(subscriptionID string, credential azcore.TokenCredential, // CheckFilePathAvailability - Check if a file path is available. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 -// - location - The name of Azure region. +// Generated from API version 2023-05-01-preview +// - location - The name of the Azure region. // - body - File path availability request. // - options - ResourceClientCheckFilePathAvailabilityOptions contains the optional parameters for the ResourceClient.CheckFilePathAvailability // method. @@ -89,7 +89,7 @@ func (client *ResourceClient) checkFilePathAvailabilityCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -110,8 +110,8 @@ func (client *ResourceClient) checkFilePathAvailabilityHandleResponse(resp *http // CheckNameAvailability - Check if a resource name is available. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 -// - location - The name of Azure region. +// Generated from API version 2023-05-01-preview +// - location - The name of the Azure region. // - body - Name availability request. // - options - ResourceClientCheckNameAvailabilityOptions contains the optional parameters for the ResourceClient.CheckNameAvailability // method. @@ -153,7 +153,7 @@ func (client *ResourceClient) checkNameAvailabilityCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -174,8 +174,8 @@ func (client *ResourceClient) checkNameAvailabilityHandleResponse(resp *http.Res // CheckQuotaAvailability - Check if a quota is available. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 -// - location - The name of Azure region. +// Generated from API version 2023-05-01-preview +// - location - The name of the Azure region. // - body - Quota availability request. // - options - ResourceClientCheckQuotaAvailabilityOptions contains the optional parameters for the ResourceClient.CheckQuotaAvailability // method. @@ -217,7 +217,7 @@ func (client *ResourceClient) checkQuotaAvailabilityCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -238,8 +238,8 @@ func (client *ResourceClient) checkQuotaAvailabilityHandleResponse(resp *http.Re // QueryNetworkSiblingSet - Get details of the specified network sibling set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 -// - location - The name of Azure region. +// Generated from API version 2023-05-01-preview +// - location - The name of the Azure region. // - body - Network sibling set to query. // - options - ResourceClientQueryNetworkSiblingSetOptions contains the optional parameters for the ResourceClient.QueryNetworkSiblingSet // method. @@ -281,7 +281,7 @@ func (client *ResourceClient) queryNetworkSiblingSetCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -302,8 +302,8 @@ func (client *ResourceClient) queryNetworkSiblingSetHandleResponse(resp *http.Re // QueryRegionInfo - Provides storage to network proximity and logical zone mapping information. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 -// - location - The name of Azure region. +// Generated from API version 2023-05-01-preview +// - location - The name of the Azure region. // - options - ResourceClientQueryRegionInfoOptions contains the optional parameters for the ResourceClient.QueryRegionInfo // method. func (client *ResourceClient) QueryRegionInfo(ctx context.Context, location string, options *ResourceClientQueryRegionInfoOptions) (ResourceClientQueryRegionInfoResponse, error) { @@ -344,7 +344,7 @@ func (client *ResourceClient) queryRegionInfoCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -362,8 +362,8 @@ func (client *ResourceClient) queryRegionInfoHandleResponse(resp *http.Response) // BeginUpdateNetworkSiblingSet - Update the network features of the specified network sibling set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 -// - location - The name of Azure region. +// Generated from API version 2023-05-01-preview +// - location - The name of the Azure region. // - body - Update for the specified network sibling set. // - options - ResourceClientBeginUpdateNetworkSiblingSetOptions contains the optional parameters for the ResourceClient.BeginUpdateNetworkSiblingSet // method. @@ -388,7 +388,7 @@ func (client *ResourceClient) BeginUpdateNetworkSiblingSet(ctx context.Context, // UpdateNetworkSiblingSet - Update the network features of the specified network sibling set. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *ResourceClient) updateNetworkSiblingSet(ctx context.Context, location string, body UpdateNetworkSiblingSetRequest, options *ResourceClientBeginUpdateNetworkSiblingSetOptions) (*http.Response, error) { var err error const operationName = "ResourceClient.BeginUpdateNetworkSiblingSet" @@ -426,7 +426,7 @@ func (client *ResourceClient) updateNetworkSiblingSetCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/resource_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/resource_client_example_test.go index 0753ff435fdf..2f561fe54a61 100644 --- a/sdk/resourcemanager/netapp/armnetapp/resource_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/resource_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/CheckNameAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/CheckNameAvailability.json func ExampleResourceClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -45,7 +45,7 @@ func ExampleResourceClient_CheckNameAvailability() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/CheckFilePathAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/CheckFilePathAvailability.json func ExampleResourceClient_CheckFilePathAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -71,7 +71,7 @@ func ExampleResourceClient_CheckFilePathAvailability() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/CheckQuotaAvailability.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/CheckQuotaAvailability.json func ExampleResourceClient_CheckQuotaAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -98,7 +98,7 @@ func ExampleResourceClient_CheckQuotaAvailability() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/RegionInfo.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/RegionInfo.json func ExampleResourceClient_QueryRegionInfo() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -126,7 +126,7 @@ func ExampleResourceClient_QueryRegionInfo() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/NetworkSiblingSet_Query.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/NetworkSiblingSet_Query.json func ExampleResourceClient_QueryNetworkSiblingSet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -174,7 +174,7 @@ func ExampleResourceClient_QueryNetworkSiblingSet() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/NetworkSiblingSet_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/NetworkSiblingSet_Update.json func ExampleResourceClient_BeginUpdateNetworkSiblingSet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/resourcequotalimits_client.go b/sdk/resourcemanager/netapp/armnetapp/resourcequotalimits_client.go index f93ec85a2ba4..5a464a31a12a 100644 --- a/sdk/resourcemanager/netapp/armnetapp/resourcequotalimits_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/resourcequotalimits_client.go @@ -28,7 +28,7 @@ type ResourceQuotaLimitsClient struct { } // NewResourceQuotaLimitsClient creates a new instance of ResourceQuotaLimitsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewResourceQuotaLimitsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceQuotaLimitsClient, error) { @@ -46,8 +46,8 @@ func NewResourceQuotaLimitsClient(subscriptionID string, credential azcore.Token // Get - Get the default and current subscription quota limit // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 -// - location - The name of Azure region. +// Generated from API version 2023-05-01-preview +// - location - The name of the Azure region. // - quotaLimitName - The name of the Quota Limit // - options - ResourceQuotaLimitsClientGetOptions contains the optional parameters for the ResourceQuotaLimitsClient.Get method. func (client *ResourceQuotaLimitsClient) Get(ctx context.Context, location string, quotaLimitName string, options *ResourceQuotaLimitsClientGetOptions) (ResourceQuotaLimitsClientGetResponse, error) { @@ -92,7 +92,7 @@ func (client *ResourceQuotaLimitsClient) getCreateRequest(ctx context.Context, l return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,8 +109,8 @@ func (client *ResourceQuotaLimitsClient) getHandleResponse(resp *http.Response) // NewListPager - Get the default and current limits for quotas // -// Generated from API version 2023-05-01 -// - location - The name of Azure region. +// Generated from API version 2023-05-01-preview +// - location - The name of the Azure region. // - options - ResourceQuotaLimitsClientListOptions contains the optional parameters for the ResourceQuotaLimitsClient.NewListPager // method. func (client *ResourceQuotaLimitsClient) NewListPager(location string, options *ResourceQuotaLimitsClientListOptions) *runtime.Pager[ResourceQuotaLimitsClientListResponse] { @@ -153,7 +153,7 @@ func (client *ResourceQuotaLimitsClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/netapp/armnetapp/resourcequotalimits_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/resourcequotalimits_client_example_test.go index 6bcca2a54c18..b94a481b6474 100644 --- a/sdk/resourcemanager/netapp/armnetapp/resourcequotalimits_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/resourcequotalimits_client_example_test.go @@ -14,10 +14,10 @@ import ( "log" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/QuotaLimits_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/QuotaLimits_List.json func ExampleResourceQuotaLimitsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -117,7 +117,7 @@ func ExampleResourceQuotaLimitsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/QuotaLimits_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/QuotaLimits_Get.json func ExampleResourceQuotaLimitsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/resourceregioninfos_client.go b/sdk/resourcemanager/netapp/armnetapp/resourceregioninfos_client.go new file mode 100644 index 000000000000..aacce94e36a7 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/resourceregioninfos_client.go @@ -0,0 +1,163 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armnetapp + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ResourceRegionInfosClient contains the methods for the NetAppResourceRegionInfos group. +// Don't use this type directly, use NewResourceRegionInfosClient() instead. +type ResourceRegionInfosClient struct { + internal *arm.Client + subscriptionID string +} + +// NewResourceRegionInfosClient creates a new instance of ResourceRegionInfosClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewResourceRegionInfosClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceRegionInfosClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ResourceRegionInfosClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Provides storage to network proximity and logical zone mapping information. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - location - The name of the Azure region. +// - options - ResourceRegionInfosClientGetOptions contains the optional parameters for the ResourceRegionInfosClient.Get method. +func (client *ResourceRegionInfosClient) Get(ctx context.Context, location string, options *ResourceRegionInfosClientGetOptions) (ResourceRegionInfosClientGetResponse, error) { + var err error + const operationName = "ResourceRegionInfosClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, options) + if err != nil { + return ResourceRegionInfosClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ResourceRegionInfosClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceRegionInfosClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ResourceRegionInfosClient) getCreateRequest(ctx context.Context, location string, options *ResourceRegionInfosClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ResourceRegionInfosClient) getHandleResponse(resp *http.Response) (ResourceRegionInfosClientGetResponse, error) { + result := ResourceRegionInfosClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RegionInfoResource); err != nil { + return ResourceRegionInfosClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Provides region specific information. +// +// Generated from API version 2023-05-01-preview +// - location - The name of the Azure region. +// - options - ResourceRegionInfosClientListOptions contains the optional parameters for the ResourceRegionInfosClient.NewListPager +// method. +func (client *ResourceRegionInfosClient) NewListPager(location string, options *ResourceRegionInfosClientListOptions) *runtime.Pager[ResourceRegionInfosClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ResourceRegionInfosClientListResponse]{ + More: func(page ResourceRegionInfosClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ResourceRegionInfosClientListResponse) (ResourceRegionInfosClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ResourceRegionInfosClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return ResourceRegionInfosClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ResourceRegionInfosClient) listCreateRequest(ctx context.Context, location string, options *ResourceRegionInfosClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfos" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ResourceRegionInfosClient) listHandleResponse(resp *http.Response) (ResourceRegionInfosClientListResponse, error) { + result := ResourceRegionInfosClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RegionInfosList); err != nil { + return ResourceRegionInfosClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/netapp/armnetapp/resourceregioninfos_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/resourceregioninfos_client_example_test.go new file mode 100644 index 000000000000..a38faca41108 --- /dev/null +++ b/sdk/resourcemanager/netapp/armnetapp/resourceregioninfos_client_example_test.go @@ -0,0 +1,108 @@ +//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. +// DO NOT EDIT. + +package armnetapp_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/RegionInfos_List.json +func ExampleResourceRegionInfosClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewResourceRegionInfosClient().NewListPager("eastus", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.RegionInfosList = armnetapp.RegionInfosList{ + // Value: []*armnetapp.RegionInfoResource{ + // { + // Name: to.Ptr("eastus/default"), + // Type: to.Ptr("Microsoft.NetApp/locations/regionInfos"), + // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/providers/Microsoft.NetApp/locations/eastus/regionInfos/default"), + // Properties: &armnetapp.RegionInfo{ + // AvailabilityZoneMappings: []*armnetapp.RegionInfoAvailabilityZoneMappingsItem{ + // { + // AvailabilityZone: to.Ptr("1"), + // IsAvailable: to.Ptr(true), + // }, + // { + // AvailabilityZone: to.Ptr("2"), + // IsAvailable: to.Ptr(true), + // }, + // { + // AvailabilityZone: to.Ptr("3"), + // IsAvailable: to.Ptr(true), + // }}, + // StorageToNetworkProximity: to.Ptr(armnetapp.RegionStorageToNetworkProximityT2), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/RegionInfos_Get.json +func ExampleResourceRegionInfosClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewResourceRegionInfosClient().Get(ctx, "eastus", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RegionInfoResource = armnetapp.RegionInfoResource{ + // Name: to.Ptr("eastus/default"), + // Type: to.Ptr("Microsoft.NetApp/locations/regionInfos"), + // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/providers/Microsoft.NetApp/locations/eastus/regionInfos/default"), + // Properties: &armnetapp.RegionInfo{ + // AvailabilityZoneMappings: []*armnetapp.RegionInfoAvailabilityZoneMappingsItem{ + // { + // AvailabilityZone: to.Ptr("1"), + // IsAvailable: to.Ptr(true), + // }, + // { + // AvailabilityZone: to.Ptr("2"), + // IsAvailable: to.Ptr(true), + // }, + // { + // AvailabilityZone: to.Ptr("3"), + // IsAvailable: to.Ptr(true), + // }}, + // StorageToNetworkProximity: to.Ptr(armnetapp.RegionStorageToNetworkProximityT2), + // }, + // } +} diff --git a/sdk/resourcemanager/netapp/armnetapp/response_types.go b/sdk/resourcemanager/netapp/armnetapp/response_types.go index c9c840a001e6..e443dc0fd583 100644 --- a/sdk/resourcemanager/netapp/armnetapp/response_types.go +++ b/sdk/resourcemanager/netapp/armnetapp/response_types.go @@ -8,6 +8,23 @@ package armnetapp +// AccountBackupsClientDeleteResponse contains the response from method AccountBackupsClient.BeginDelete. +type AccountBackupsClientDeleteResponse struct { + // placeholder for future response values +} + +// AccountBackupsClientGetResponse contains the response from method AccountBackupsClient.Get. +type AccountBackupsClientGetResponse struct { + // Backup under a Backup Vault + Backup +} + +// AccountBackupsClientListByNetAppAccountResponse contains the response from method AccountBackupsClient.NewListByNetAppAccountPager. +type AccountBackupsClientListByNetAppAccountResponse struct { + // List of Backups + BackupsList +} + // AccountsClientCreateOrUpdateResponse contains the response from method AccountsClient.BeginCreateOrUpdate. type AccountsClientCreateOrUpdateResponse struct { // NetApp account resource @@ -37,6 +54,11 @@ type AccountsClientListResponse struct { AccountList } +// AccountsClientMigrateEncryptionKeyResponse contains the response from method AccountsClient.BeginMigrateEncryptionKey. +type AccountsClientMigrateEncryptionKeyResponse struct { + // placeholder for future response values +} + // AccountsClientRenewCredentialsResponse contains the response from method AccountsClient.BeginRenewCredentials. type AccountsClientRenewCredentialsResponse struct { // placeholder for future response values @@ -77,12 +99,91 @@ type BackupPoliciesClientUpdateResponse struct { BackupPolicy } +// BackupVaultsClientCreateOrUpdateResponse contains the response from method BackupVaultsClient.BeginCreateOrUpdate. +type BackupVaultsClientCreateOrUpdateResponse struct { + // Backup Vault information + BackupVault +} + +// BackupVaultsClientDeleteResponse contains the response from method BackupVaultsClient.BeginDelete. +type BackupVaultsClientDeleteResponse struct { + // placeholder for future response values +} + +// BackupVaultsClientGetResponse contains the response from method BackupVaultsClient.Get. +type BackupVaultsClientGetResponse struct { + // Backup Vault information + BackupVault +} + +// BackupVaultsClientListByNetAppAccountResponse contains the response from method BackupVaultsClient.NewListByNetAppAccountPager. +type BackupVaultsClientListByNetAppAccountResponse struct { + // List of Backup Vaults + BackupVaultsList +} + +// BackupVaultsClientUpdateResponse contains the response from method BackupVaultsClient.BeginUpdate. +type BackupVaultsClientUpdateResponse struct { + // Backup Vault information + BackupVault +} + +// BackupsClientCreateResponse contains the response from method BackupsClient.BeginCreate. +type BackupsClientCreateResponse struct { + // Backup under a Backup Vault + Backup +} + +// BackupsClientDeleteResponse contains the response from method BackupsClient.BeginDelete. +type BackupsClientDeleteResponse struct { + // placeholder for future response values +} + +// BackupsClientGetLatestStatusResponse contains the response from method BackupsClient.GetLatestStatus. +type BackupsClientGetLatestStatusResponse struct { + // Backup status + BackupStatus +} + +// BackupsClientGetResponse contains the response from method BackupsClient.Get. +type BackupsClientGetResponse struct { + // Backup under a Backup Vault + Backup +} + // BackupsClientGetVolumeRestoreStatusResponse contains the response from method BackupsClient.GetVolumeRestoreStatus. type BackupsClientGetVolumeRestoreStatusResponse struct { // Restore status RestoreStatus } +// BackupsClientListByVaultResponse contains the response from method BackupsClient.NewListByVaultPager. +type BackupsClientListByVaultResponse struct { + // List of Backups + BackupsList +} + +// BackupsClientUpdateResponse contains the response from method BackupsClient.BeginUpdate. +type BackupsClientUpdateResponse struct { + // Backup under a Backup Vault + Backup +} + +// BackupsUnderAccountClientMigrateBackupsResponse contains the response from method BackupsUnderAccountClient.BeginMigrateBackups. +type BackupsUnderAccountClientMigrateBackupsResponse struct { + // placeholder for future response values +} + +// BackupsUnderBackupVaultClientRestoreFilesResponse contains the response from method BackupsUnderBackupVaultClient.BeginRestoreFiles. +type BackupsUnderBackupVaultClientRestoreFilesResponse struct { + // placeholder for future response values +} + +// BackupsUnderVolumeClientMigrateBackupsResponse contains the response from method BackupsUnderVolumeClient.BeginMigrateBackups. +type BackupsUnderVolumeClientMigrateBackupsResponse struct { + // placeholder for future response values +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { // Result of the request to list Cloud Volume operations. It contains a list of operations and a URL link to get the next @@ -167,6 +268,18 @@ type ResourceQuotaLimitsClientListResponse struct { SubscriptionQuotaItemList } +// ResourceRegionInfosClientGetResponse contains the response from method ResourceRegionInfosClient.Get. +type ResourceRegionInfosClientGetResponse struct { + // Information regarding regionInfo Item. + RegionInfoResource +} + +// ResourceRegionInfosClientListResponse contains the response from method ResourceRegionInfosClient.NewListPager. +type ResourceRegionInfosClientListResponse struct { + // List of regionInfo resources + RegionInfosList +} + // SnapshotPoliciesClientCreateResponse contains the response from method SnapshotPoliciesClient.Create. type SnapshotPoliciesClientCreateResponse struct { // Snapshot policy information @@ -435,6 +548,11 @@ type VolumesClientRevertResponse struct { // placeholder for future response values } +// VolumesClientSplitCloneFromParentResponse contains the response from method VolumesClient.BeginSplitCloneFromParent. +type VolumesClientSplitCloneFromParentResponse struct { + // placeholder for future response values +} + // VolumesClientUpdateResponse contains the response from method VolumesClient.BeginUpdate. type VolumesClientUpdateResponse struct { // Volume resource diff --git a/sdk/resourcemanager/netapp/armnetapp/snapshotpolicies_client.go b/sdk/resourcemanager/netapp/armnetapp/snapshotpolicies_client.go index a0a1fa379f53..c06f298bb1f9 100644 --- a/sdk/resourcemanager/netapp/armnetapp/snapshotpolicies_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/snapshotpolicies_client.go @@ -28,7 +28,7 @@ type SnapshotPoliciesClient struct { } // NewSnapshotPoliciesClient creates a new instance of SnapshotPoliciesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSnapshotPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SnapshotPoliciesClient, error) { @@ -46,7 +46,7 @@ func NewSnapshotPoliciesClient(subscriptionID string, credential azcore.TokenCre // Create - Create a snapshot policy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - snapshotPolicyName - The name of the snapshot policy @@ -98,7 +98,7 @@ func (client *SnapshotPoliciesClient) createCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -119,7 +119,7 @@ func (client *SnapshotPoliciesClient) createHandleResponse(resp *http.Response) // BeginDelete - Delete snapshot policy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - snapshotPolicyName - The name of the snapshot policy @@ -146,7 +146,7 @@ func (client *SnapshotPoliciesClient) BeginDelete(ctx context.Context, resourceG // Delete - Delete snapshot policy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *SnapshotPoliciesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string, options *SnapshotPoliciesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SnapshotPoliciesClient.BeginDelete" @@ -192,7 +192,7 @@ func (client *SnapshotPoliciesClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -200,7 +200,7 @@ func (client *SnapshotPoliciesClient) deleteCreateRequest(ctx context.Context, r // Get - Get a snapshot Policy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - snapshotPolicyName - The name of the snapshot policy @@ -251,7 +251,7 @@ func (client *SnapshotPoliciesClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -268,7 +268,7 @@ func (client *SnapshotPoliciesClient) getHandleResponse(resp *http.Response) (Sn // NewListPager - List snapshot policy // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - options - SnapshotPoliciesClientListOptions contains the optional parameters for the SnapshotPoliciesClient.NewListPager @@ -317,7 +317,7 @@ func (client *SnapshotPoliciesClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -335,7 +335,7 @@ func (client *SnapshotPoliciesClient) listHandleResponse(resp *http.Response) (S // ListVolumes - Get volumes associated with snapshot policy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - snapshotPolicyName - The name of the snapshot policy @@ -387,7 +387,7 @@ func (client *SnapshotPoliciesClient) listVolumesCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -405,7 +405,7 @@ func (client *SnapshotPoliciesClient) listVolumesHandleResponse(resp *http.Respo // BeginUpdate - Patch a snapshot policy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - snapshotPolicyName - The name of the snapshot policy @@ -433,7 +433,7 @@ func (client *SnapshotPoliciesClient) BeginUpdate(ctx context.Context, resourceG // Update - Patch a snapshot policy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *SnapshotPoliciesClient) update(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string, body SnapshotPolicyPatch, options *SnapshotPoliciesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "SnapshotPoliciesClient.BeginUpdate" @@ -479,7 +479,7 @@ func (client *SnapshotPoliciesClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/snapshotpolicies_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/snapshotpolicies_client_example_test.go index e83a3047e925..0fc7f3f31dab 100644 --- a/sdk/resourcemanager/netapp/armnetapp/snapshotpolicies_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/snapshotpolicies_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/SnapshotPolicies_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/SnapshotPolicies_List.json func ExampleSnapshotPoliciesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,7 +77,7 @@ func ExampleSnapshotPoliciesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/SnapshotPolicies_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/SnapshotPolicies_Get.json func ExampleSnapshotPoliciesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -128,7 +128,7 @@ func ExampleSnapshotPoliciesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/SnapshotPolicies_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/SnapshotPolicies_Create.json func ExampleSnapshotPoliciesClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -205,7 +205,7 @@ func ExampleSnapshotPoliciesClient_Create() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/SnapshotPolicies_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/SnapshotPolicies_Update.json func ExampleSnapshotPoliciesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -286,7 +286,7 @@ func ExampleSnapshotPoliciesClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/SnapshotPolicies_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/SnapshotPolicies_Delete.json func ExampleSnapshotPoliciesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -307,7 +307,7 @@ func ExampleSnapshotPoliciesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/SnapshotPolicies_ListVolumes.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/SnapshotPolicies_ListVolumes.json func ExampleSnapshotPoliciesClient_ListVolumes() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/snapshots_client.go b/sdk/resourcemanager/netapp/armnetapp/snapshots_client.go index 191c5466a1b2..ba5e46b24b93 100644 --- a/sdk/resourcemanager/netapp/armnetapp/snapshots_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/snapshots_client.go @@ -28,7 +28,7 @@ type SnapshotsClient struct { } // NewSnapshotsClient creates a new instance of SnapshotsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSnapshotsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SnapshotsClient, error) { @@ -46,7 +46,7 @@ func NewSnapshotsClient(subscriptionID string, credential azcore.TokenCredential // BeginCreate - Create the specified snapshot within the given volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -75,7 +75,7 @@ func (client *SnapshotsClient) BeginCreate(ctx context.Context, resourceGroupNam // Create - Create the specified snapshot within the given volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *SnapshotsClient) create(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, body Snapshot, options *SnapshotsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "SnapshotsClient.BeginCreate" @@ -129,7 +129,7 @@ func (client *SnapshotsClient) createCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -141,7 +141,7 @@ func (client *SnapshotsClient) createCreateRequest(ctx context.Context, resource // BeginDelete - Delete snapshot // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -169,7 +169,7 @@ func (client *SnapshotsClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Delete snapshot // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *SnapshotsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, options *SnapshotsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SnapshotsClient.BeginDelete" @@ -223,7 +223,7 @@ func (client *SnapshotsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -231,7 +231,7 @@ func (client *SnapshotsClient) deleteCreateRequest(ctx context.Context, resource // Get - Get details of the specified snapshot // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -292,7 +292,7 @@ func (client *SnapshotsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -309,7 +309,7 @@ func (client *SnapshotsClient) getHandleResponse(resp *http.Response) (Snapshots // NewListPager - List all snapshots associated with the volume // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -367,7 +367,7 @@ func (client *SnapshotsClient) listCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -385,7 +385,7 @@ func (client *SnapshotsClient) listHandleResponse(resp *http.Response) (Snapshot // BeginRestoreFiles - Restore the specified files from the specified snapshot to the active filesystem // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -415,7 +415,7 @@ func (client *SnapshotsClient) BeginRestoreFiles(ctx context.Context, resourceGr // RestoreFiles - Restore the specified files from the specified snapshot to the active filesystem // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *SnapshotsClient) restoreFiles(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, body SnapshotRestoreFiles, options *SnapshotsClientBeginRestoreFilesOptions) (*http.Response, error) { var err error const operationName = "SnapshotsClient.BeginRestoreFiles" @@ -469,7 +469,7 @@ func (client *SnapshotsClient) restoreFilesCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err @@ -480,7 +480,7 @@ func (client *SnapshotsClient) restoreFilesCreateRequest(ctx context.Context, re // BeginUpdate - Patch a snapshot // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -509,7 +509,7 @@ func (client *SnapshotsClient) BeginUpdate(ctx context.Context, resourceGroupNam // Update - Patch a snapshot // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *SnapshotsClient) update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string, body any, options *SnapshotsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "SnapshotsClient.BeginUpdate" @@ -563,7 +563,7 @@ func (client *SnapshotsClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/snapshots_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/snapshots_client_example_test.go index 8cab8d03883e..77cfc41b3679 100644 --- a/sdk/resourcemanager/netapp/armnetapp/snapshots_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/snapshots_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Snapshots_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Snapshots_List.json func ExampleSnapshotsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -57,7 +57,7 @@ func ExampleSnapshotsClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Snapshots_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Snapshots_Get.json func ExampleSnapshotsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -88,7 +88,7 @@ func ExampleSnapshotsClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Snapshots_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Snapshots_Create.json func ExampleSnapshotsClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -111,7 +111,7 @@ func ExampleSnapshotsClient_BeginCreate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Snapshots_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Snapshots_Update.json func ExampleSnapshotsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -146,7 +146,7 @@ func ExampleSnapshotsClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Snapshots_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Snapshots_Delete.json func ExampleSnapshotsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -167,7 +167,7 @@ func ExampleSnapshotsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Snapshots_SingleFileRestore.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Snapshots_SingleFileRestore.json func ExampleSnapshotsClient_BeginRestoreFiles() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/subvolumes_client.go b/sdk/resourcemanager/netapp/armnetapp/subvolumes_client.go index 23b75b81bffb..cec20fc66edc 100644 --- a/sdk/resourcemanager/netapp/armnetapp/subvolumes_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/subvolumes_client.go @@ -28,7 +28,7 @@ type SubvolumesClient struct { } // NewSubvolumesClient creates a new instance of SubvolumesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSubvolumesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SubvolumesClient, error) { @@ -46,7 +46,7 @@ func NewSubvolumesClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreate - Creates a subvolume in the path or clones the subvolume mentioned in the parentPath // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -75,7 +75,7 @@ func (client *SubvolumesClient) BeginCreate(ctx context.Context, resourceGroupNa // Create - Creates a subvolume in the path or clones the subvolume mentioned in the parentPath // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *SubvolumesClient) create(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string, body SubvolumeInfo, options *SubvolumesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "SubvolumesClient.BeginCreate" @@ -129,7 +129,7 @@ func (client *SubvolumesClient) createCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -141,7 +141,7 @@ func (client *SubvolumesClient) createCreateRequest(ctx context.Context, resourc // BeginDelete - Delete subvolume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -169,7 +169,7 @@ func (client *SubvolumesClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Delete subvolume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *SubvolumesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string, options *SubvolumesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SubvolumesClient.BeginDelete" @@ -223,7 +223,7 @@ func (client *SubvolumesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -231,7 +231,7 @@ func (client *SubvolumesClient) deleteCreateRequest(ctx context.Context, resourc // Get - Returns the path associated with the subvolumeName provided // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -292,7 +292,7 @@ func (client *SubvolumesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -310,7 +310,7 @@ func (client *SubvolumesClient) getHandleResponse(resp *http.Response) (Subvolum // BeginGetMetadata - Get details of the specified subvolume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -339,7 +339,7 @@ func (client *SubvolumesClient) BeginGetMetadata(ctx context.Context, resourceGr // GetMetadata - Get details of the specified subvolume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *SubvolumesClient) getMetadata(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string, options *SubvolumesClientBeginGetMetadataOptions) (*http.Response, error) { var err error const operationName = "SubvolumesClient.BeginGetMetadata" @@ -393,7 +393,7 @@ func (client *SubvolumesClient) getMetadataCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -401,7 +401,7 @@ func (client *SubvolumesClient) getMetadataCreateRequest(ctx context.Context, re // NewListByVolumePager - Returns a list of the subvolumes in the volume // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -459,7 +459,7 @@ func (client *SubvolumesClient) listByVolumeCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -477,7 +477,7 @@ func (client *SubvolumesClient) listByVolumeHandleResponse(resp *http.Response) // BeginUpdate - Patch a subvolume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -506,7 +506,7 @@ func (client *SubvolumesClient) BeginUpdate(ctx context.Context, resourceGroupNa // Update - Patch a subvolume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *SubvolumesClient) update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string, body SubvolumePatchRequest, options *SubvolumesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "SubvolumesClient.BeginUpdate" @@ -560,7 +560,7 @@ func (client *SubvolumesClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/subvolumes_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/subvolumes_client_example_test.go index 401c3f41ff58..b0eed9f995e1 100644 --- a/sdk/resourcemanager/netapp/armnetapp/subvolumes_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/subvolumes_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Subvolumes_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Subvolumes_List.json func ExampleSubvolumesClient_NewListByVolumePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -54,7 +54,7 @@ func ExampleSubvolumesClient_NewListByVolumePager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Subvolumes_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Subvolumes_Get.json func ExampleSubvolumesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -82,7 +82,7 @@ func ExampleSubvolumesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Subvolumes_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Subvolumes_Create.json func ExampleSubvolumesClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -119,7 +119,7 @@ func ExampleSubvolumesClient_BeginCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Subvolumes_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Subvolumes_Update.json func ExampleSubvolumesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -155,7 +155,7 @@ func ExampleSubvolumesClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Subvolumes_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Subvolumes_Delete.json func ExampleSubvolumesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -176,7 +176,7 @@ func ExampleSubvolumesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Subvolumes_Metadata.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Subvolumes_Metadata.json func ExampleSubvolumesClient_BeginGetMetadata() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/volumegroups_client.go b/sdk/resourcemanager/netapp/armnetapp/volumegroups_client.go index df1a49d0c553..5d82d141b5d6 100644 --- a/sdk/resourcemanager/netapp/armnetapp/volumegroups_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/volumegroups_client.go @@ -28,7 +28,7 @@ type VolumeGroupsClient struct { } // NewVolumeGroupsClient creates a new instance of VolumeGroupsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewVolumeGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VolumeGroupsClient, error) { @@ -46,7 +46,7 @@ func NewVolumeGroupsClient(subscriptionID string, credential azcore.TokenCredent // BeginCreate - Create a volume group along with specified volumes // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - volumeGroupName - The name of the volumeGroup @@ -73,7 +73,7 @@ func (client *VolumeGroupsClient) BeginCreate(ctx context.Context, resourceGroup // Create - Create a volume group along with specified volumes // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumeGroupsClient) create(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string, body VolumeGroupDetails, options *VolumeGroupsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "VolumeGroupsClient.BeginCreate" @@ -119,7 +119,7 @@ func (client *VolumeGroupsClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -131,7 +131,7 @@ func (client *VolumeGroupsClient) createCreateRequest(ctx context.Context, resou // BeginDelete - Delete the specified volume group only if there are no volumes under volume group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - volumeGroupName - The name of the volumeGroup @@ -157,7 +157,7 @@ func (client *VolumeGroupsClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Delete the specified volume group only if there are no volumes under volume group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumeGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string, options *VolumeGroupsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VolumeGroupsClient.BeginDelete" @@ -203,7 +203,7 @@ func (client *VolumeGroupsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -211,7 +211,7 @@ func (client *VolumeGroupsClient) deleteCreateRequest(ctx context.Context, resou // Get - Get details of the specified volume group // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - volumeGroupName - The name of the volumeGroup @@ -262,7 +262,7 @@ func (client *VolumeGroupsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -279,7 +279,7 @@ func (client *VolumeGroupsClient) getHandleResponse(resp *http.Response) (Volume // NewListByNetAppAccountPager - List all volume groups for given account // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - options - VolumeGroupsClientListByNetAppAccountOptions contains the optional parameters for the VolumeGroupsClient.NewListByNetAppAccountPager @@ -328,7 +328,7 @@ func (client *VolumeGroupsClient) listByNetAppAccountCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/netapp/armnetapp/volumegroups_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/volumegroups_client_example_test.go index 4d40d72c3427..e4c49c180034 100644 --- a/sdk/resourcemanager/netapp/armnetapp/volumegroups_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/volumegroups_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/VolumeGroups_List_Oracle.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/VolumeGroups_List_Oracle.json func ExampleVolumeGroupsClient_NewListByNetAppAccountPager_volumeGroupsListOracle() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -61,7 +61,7 @@ func ExampleVolumeGroupsClient_NewListByNetAppAccountPager_volumeGroupsListOracl } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/VolumeGroups_List_SapHana.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/VolumeGroups_List_SapHana.json func ExampleVolumeGroupsClient_NewListByNetAppAccountPager_volumeGroupsListSapHana() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -92,7 +92,7 @@ func ExampleVolumeGroupsClient_NewListByNetAppAccountPager_volumeGroupsListSapHa // Location: to.Ptr("eastus"), // Properties: &armnetapp.VolumeGroupListProperties{ // GroupMetaData: &armnetapp.VolumeGroupMetaData{ - // ApplicationIdentifier: to.Ptr("SH9"), + // ApplicationIdentifier: to.Ptr("DEV"), // ApplicationType: to.Ptr(armnetapp.ApplicationTypeSAPHANA), // GroupDescription: to.Ptr("Volume group"), // VolumesCount: to.Ptr[int64](5), @@ -104,7 +104,7 @@ func ExampleVolumeGroupsClient_NewListByNetAppAccountPager_volumeGroupsListSapHa } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/VolumeGroups_Get_Oracle.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/VolumeGroups_Get_Oracle.json func ExampleVolumeGroupsClient_Get_volumeGroupsGetOracle() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -584,7 +584,7 @@ func ExampleVolumeGroupsClient_Get_volumeGroupsGetOracle() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/VolumeGroups_Get_SapHana.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/VolumeGroups_Get_SapHana.json func ExampleVolumeGroupsClient_Get_volumeGroupsGetSapHana() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -800,7 +800,7 @@ func ExampleVolumeGroupsClient_Get_volumeGroupsGetSapHana() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/VolumeGroups_Create_Oracle.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/VolumeGroups_Create_Oracle.json func ExampleVolumeGroupsClient_BeginCreate_volumeGroupsCreateOracle() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1251,7 +1251,7 @@ func ExampleVolumeGroupsClient_BeginCreate_volumeGroupsCreateOracle() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/VolumeGroups_Create_SapHana.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/VolumeGroups_Create_SapHana.json func ExampleVolumeGroupsClient_BeginCreate_volumeGroupsCreateSapHana() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1452,7 +1452,7 @@ func ExampleVolumeGroupsClient_BeginCreate_volumeGroupsCreateSapHana() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/VolumeGroups_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/VolumeGroups_Delete.json func ExampleVolumeGroupsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/volumequotarules_client.go b/sdk/resourcemanager/netapp/armnetapp/volumequotarules_client.go index 1e4e1a968cc5..405976bcbafe 100644 --- a/sdk/resourcemanager/netapp/armnetapp/volumequotarules_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/volumequotarules_client.go @@ -28,7 +28,7 @@ type VolumeQuotaRulesClient struct { } // NewVolumeQuotaRulesClient creates a new instance of VolumeQuotaRulesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewVolumeQuotaRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VolumeQuotaRulesClient, error) { @@ -46,7 +46,7 @@ func NewVolumeQuotaRulesClient(subscriptionID string, credential azcore.TokenCre // BeginCreate - Create the specified quota rule within the given volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -76,7 +76,7 @@ func (client *VolumeQuotaRulesClient) BeginCreate(ctx context.Context, resourceG // Create - Create the specified quota rule within the given volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumeQuotaRulesClient) create(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, volumeQuotaRuleName string, body VolumeQuotaRule, options *VolumeQuotaRulesClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "VolumeQuotaRulesClient.BeginCreate" @@ -130,7 +130,7 @@ func (client *VolumeQuotaRulesClient) createCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -142,7 +142,7 @@ func (client *VolumeQuotaRulesClient) createCreateRequest(ctx context.Context, r // BeginDelete - Delete quota rule // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -171,7 +171,7 @@ func (client *VolumeQuotaRulesClient) BeginDelete(ctx context.Context, resourceG // Delete - Delete quota rule // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumeQuotaRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, volumeQuotaRuleName string, options *VolumeQuotaRulesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VolumeQuotaRulesClient.BeginDelete" @@ -225,7 +225,7 @@ func (client *VolumeQuotaRulesClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -233,7 +233,7 @@ func (client *VolumeQuotaRulesClient) deleteCreateRequest(ctx context.Context, r // Get - Get details of the specified quota rule // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -294,7 +294,7 @@ func (client *VolumeQuotaRulesClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -311,7 +311,7 @@ func (client *VolumeQuotaRulesClient) getHandleResponse(resp *http.Response) (Vo // NewListByVolumePager - List all quota rules associated with the volume // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -370,7 +370,7 @@ func (client *VolumeQuotaRulesClient) listByVolumeCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -388,7 +388,7 @@ func (client *VolumeQuotaRulesClient) listByVolumeHandleResponse(resp *http.Resp // BeginUpdate - Patch a quota rule // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -418,7 +418,7 @@ func (client *VolumeQuotaRulesClient) BeginUpdate(ctx context.Context, resourceG // Update - Patch a quota rule // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumeQuotaRulesClient) update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, volumeQuotaRuleName string, body VolumeQuotaRulePatch, options *VolumeQuotaRulesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VolumeQuotaRulesClient.BeginUpdate" @@ -472,7 +472,7 @@ func (client *VolumeQuotaRulesClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/volumequotarules_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/volumequotarules_client_example_test.go index 3d7dcb9ab83a..49f2efe86b03 100644 --- a/sdk/resourcemanager/netapp/armnetapp/volumequotarules_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/volumequotarules_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/VolumeQuotaRules_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/VolumeQuotaRules_List.json func ExampleVolumeQuotaRulesClient_NewListByVolumePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -58,7 +58,7 @@ func ExampleVolumeQuotaRulesClient_NewListByVolumePager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/VolumeQuotaRules_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/VolumeQuotaRules_Get.json func ExampleVolumeQuotaRulesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -90,7 +90,7 @@ func ExampleVolumeQuotaRulesClient_Get() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/VolumeQuotaRules_Create.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/VolumeQuotaRules_Create.json func ExampleVolumeQuotaRulesClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -133,7 +133,7 @@ func ExampleVolumeQuotaRulesClient_BeginCreate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/VolumeQuotaRules_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/VolumeQuotaRules_Update.json func ExampleVolumeQuotaRulesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -173,7 +173,7 @@ func ExampleVolumeQuotaRulesClient_BeginUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/VolumeQuotaRules_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/VolumeQuotaRules_Delete.json func ExampleVolumeQuotaRulesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/volumes_client.go b/sdk/resourcemanager/netapp/armnetapp/volumes_client.go index 07330aaca5ac..5aed2a6a1e15 100644 --- a/sdk/resourcemanager/netapp/armnetapp/volumes_client.go +++ b/sdk/resourcemanager/netapp/armnetapp/volumes_client.go @@ -29,7 +29,7 @@ type VolumesClient struct { } // NewVolumesClient creates a new instance of VolumesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewVolumesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VolumesClient, error) { @@ -47,7 +47,7 @@ func NewVolumesClient(subscriptionID string, credential azcore.TokenCredential, // BeginAuthorizeReplication - Authorize the replication connection on the source volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -76,7 +76,7 @@ func (client *VolumesClient) BeginAuthorizeReplication(ctx context.Context, reso // AuthorizeReplication - Authorize the replication connection on the source volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) authorizeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body AuthorizeRequest, options *VolumesClientBeginAuthorizeReplicationOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginAuthorizeReplication" @@ -126,7 +126,7 @@ func (client *VolumesClient) authorizeReplicationCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err @@ -137,7 +137,7 @@ func (client *VolumesClient) authorizeReplicationCreateRequest(ctx context.Conte // BeginBreakFileLocks - Break all the file locks on a volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -165,7 +165,7 @@ func (client *VolumesClient) BeginBreakFileLocks(ctx context.Context, resourceGr // BreakFileLocks - Break all the file locks on a volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) breakFileLocks(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginBreakFileLocksOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginBreakFileLocks" @@ -215,7 +215,7 @@ func (client *VolumesClient) breakFileLocksCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.Body != nil { if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { @@ -229,7 +229,7 @@ func (client *VolumesClient) breakFileLocksCreateRequest(ctx context.Context, re // BeginBreakReplication - Break the replication connection on the destination volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -257,7 +257,7 @@ func (client *VolumesClient) BeginBreakReplication(ctx context.Context, resource // BreakReplication - Break the replication connection on the destination volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) breakReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginBreakReplicationOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginBreakReplication" @@ -307,7 +307,7 @@ func (client *VolumesClient) breakReplicationCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.Body != nil { if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { @@ -321,7 +321,7 @@ func (client *VolumesClient) breakReplicationCreateRequest(ctx context.Context, // BeginCreateOrUpdate - Create or update the specified volume within the capacity pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -350,7 +350,7 @@ func (client *VolumesClient) BeginCreateOrUpdate(ctx context.Context, resourceGr // CreateOrUpdate - Create or update the specified volume within the capacity pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) createOrUpdate(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body Volume, options *VolumesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginCreateOrUpdate" @@ -400,7 +400,7 @@ func (client *VolumesClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -412,7 +412,7 @@ func (client *VolumesClient) createOrUpdateCreateRequest(ctx context.Context, re // BeginDelete - Delete the specified volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -439,7 +439,7 @@ func (client *VolumesClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete the specified volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginDelete" @@ -492,7 +492,7 @@ func (client *VolumesClient) deleteCreateRequest(ctx context.Context, resourceGr if options != nil && options.ForceDelete != nil { reqQP.Set("forceDelete", strconv.FormatBool(*options.ForceDelete)) } - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -500,7 +500,7 @@ func (client *VolumesClient) deleteCreateRequest(ctx context.Context, resourceGr // BeginDeleteReplication - Delete the replication connection on the destination volume, and send release to the source replication // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -528,7 +528,7 @@ func (client *VolumesClient) BeginDeleteReplication(ctx context.Context, resourc // DeleteReplication - Delete the replication connection on the destination volume, and send release to the source replication // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) deleteReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginDeleteReplicationOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginDeleteReplication" @@ -578,7 +578,7 @@ func (client *VolumesClient) deleteReplicationCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -586,7 +586,7 @@ func (client *VolumesClient) deleteReplicationCreateRequest(ctx context.Context, // BeginFinalizeRelocation - Finalizes the relocation of the volume and cleans up the old volume. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -613,7 +613,7 @@ func (client *VolumesClient) BeginFinalizeRelocation(ctx context.Context, resour // FinalizeRelocation - Finalizes the relocation of the volume and cleans up the old volume. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) finalizeRelocation(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginFinalizeRelocationOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginFinalizeRelocation" @@ -663,7 +663,7 @@ func (client *VolumesClient) finalizeRelocationCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -671,7 +671,7 @@ func (client *VolumesClient) finalizeRelocationCreateRequest(ctx context.Context // Get - Get the details of the specified volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -727,7 +727,7 @@ func (client *VolumesClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -744,7 +744,7 @@ func (client *VolumesClient) getHandleResponse(resp *http.Response) (VolumesClie // NewListPager - List all volumes within the capacity pool // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -796,7 +796,7 @@ func (client *VolumesClient) listCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -814,7 +814,7 @@ func (client *VolumesClient) listHandleResponse(resp *http.Response) (VolumesCli // BeginListGetGroupIDListForLdapUser - Returns the list of group Ids for a specific LDAP User // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -843,7 +843,7 @@ func (client *VolumesClient) BeginListGetGroupIDListForLdapUser(ctx context.Cont // ListGetGroupIDListForLdapUser - Returns the list of group Ids for a specific LDAP User // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) listGetGroupIDListForLdapUser(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body GetGroupIDListForLDAPUserRequest, options *VolumesClientBeginListGetGroupIDListForLdapUserOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginListGetGroupIDListForLdapUser" @@ -893,7 +893,7 @@ func (client *VolumesClient) listGetGroupIDListForLdapUserCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -904,7 +904,7 @@ func (client *VolumesClient) listGetGroupIDListForLdapUserCreateRequest(ctx cont // NewListReplicationsPager - List all replications for a specified volume // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -963,7 +963,7 @@ func (client *VolumesClient) listReplicationsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -981,7 +981,7 @@ func (client *VolumesClient) listReplicationsHandleResponse(resp *http.Response) // BeginPoolChange - Moves volume to another pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -1009,7 +1009,7 @@ func (client *VolumesClient) BeginPoolChange(ctx context.Context, resourceGroupN // PoolChange - Moves volume to another pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) poolChange(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body PoolChangeRequest, options *VolumesClientBeginPoolChangeOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginPoolChange" @@ -1059,7 +1059,7 @@ func (client *VolumesClient) poolChangeCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err @@ -1070,7 +1070,7 @@ func (client *VolumesClient) poolChangeCreateRequest(ctx context.Context, resour // BeginPopulateAvailabilityZone - This operation will populate availability zone information for a volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -1098,7 +1098,7 @@ func (client *VolumesClient) BeginPopulateAvailabilityZone(ctx context.Context, // PopulateAvailabilityZone - This operation will populate availability zone information for a volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) populateAvailabilityZone(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginPopulateAvailabilityZoneOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginPopulateAvailabilityZone" @@ -1148,7 +1148,7 @@ func (client *VolumesClient) populateAvailabilityZoneCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1157,7 +1157,7 @@ func (client *VolumesClient) populateAvailabilityZoneCreateRequest(ctx context.C // BeginReInitializeReplication - Re-Initializes the replication connection on the destination volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -1185,7 +1185,7 @@ func (client *VolumesClient) BeginReInitializeReplication(ctx context.Context, r // ReInitializeReplication - Re-Initializes the replication connection on the destination volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) reInitializeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginReInitializeReplicationOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginReInitializeReplication" @@ -1235,7 +1235,7 @@ func (client *VolumesClient) reInitializeReplicationCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -1244,7 +1244,7 @@ func (client *VolumesClient) reInitializeReplicationCreateRequest(ctx context.Co // or policy-based snapshots // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -1274,7 +1274,7 @@ func (client *VolumesClient) BeginReestablishReplication(ctx context.Context, re // snapshots // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) reestablishReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body ReestablishReplicationRequest, options *VolumesClientBeginReestablishReplicationOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginReestablishReplication" @@ -1324,7 +1324,7 @@ func (client *VolumesClient) reestablishReplicationCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err @@ -1335,7 +1335,7 @@ func (client *VolumesClient) reestablishReplicationCreateRequest(ctx context.Con // BeginRelocate - Relocates volume to a new stamp // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -1361,7 +1361,7 @@ func (client *VolumesClient) BeginRelocate(ctx context.Context, resourceGroupNam // Relocate - Relocates volume to a new stamp // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) relocate(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginRelocateOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginRelocate" @@ -1411,7 +1411,7 @@ func (client *VolumesClient) relocateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.Body != nil { if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { @@ -1425,7 +1425,7 @@ func (client *VolumesClient) relocateCreateRequest(ctx context.Context, resource // ReplicationStatus - Get the status of the replication // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -1482,7 +1482,7 @@ func (client *VolumesClient) replicationStatusCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1500,7 +1500,7 @@ func (client *VolumesClient) replicationStatusHandleResponse(resp *http.Response // BeginResetCifsPassword - Reset cifs password from volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -1527,7 +1527,7 @@ func (client *VolumesClient) BeginResetCifsPassword(ctx context.Context, resourc // ResetCifsPassword - Reset cifs password from volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) resetCifsPassword(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginResetCifsPasswordOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginResetCifsPassword" @@ -1542,7 +1542,7 @@ func (client *VolumesClient) resetCifsPassword(ctx context.Context, resourceGrou if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { err = runtime.NewResponseError(httpResp) return nil, err } @@ -1577,7 +1577,7 @@ func (client *VolumesClient) resetCifsPasswordCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -1586,7 +1586,7 @@ func (client *VolumesClient) resetCifsPasswordCreateRequest(ctx context.Context, // it will reverse-resync the connection and sync from destination to source. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -1615,7 +1615,7 @@ func (client *VolumesClient) BeginResyncReplication(ctx context.Context, resourc // reverse-resync the connection and sync from destination to source. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) resyncReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginResyncReplicationOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginResyncReplication" @@ -1665,7 +1665,7 @@ func (client *VolumesClient) resyncReplicationCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -1673,7 +1673,7 @@ func (client *VolumesClient) resyncReplicationCreateRequest(ctx context.Context, // BeginRevert - Revert a volume to the snapshot specified in the body // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -1701,7 +1701,7 @@ func (client *VolumesClient) BeginRevert(ctx context.Context, resourceGroupName // Revert - Revert a volume to the snapshot specified in the body // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) revert(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumeRevert, options *VolumesClientBeginRevertOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginRevert" @@ -1751,7 +1751,7 @@ func (client *VolumesClient) revertCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err @@ -1763,7 +1763,7 @@ func (client *VolumesClient) revertCreateRequest(ctx context.Context, resourceGr // volume. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -1791,7 +1791,7 @@ func (client *VolumesClient) BeginRevertRelocation(ctx context.Context, resource // volume. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) revertRelocation(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginRevertRelocationOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginRevertRelocation" @@ -1841,15 +1841,102 @@ func (client *VolumesClient) revertRelocationCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } +// BeginSplitCloneFromParent - Split operation to convert clone volume to an independent volume. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - accountName - The name of the NetApp account +// - poolName - The name of the capacity pool +// - volumeName - The name of the volume +// - options - VolumesClientBeginSplitCloneFromParentOptions contains the optional parameters for the VolumesClient.BeginSplitCloneFromParent +// method. +func (client *VolumesClient) BeginSplitCloneFromParent(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginSplitCloneFromParentOptions) (*runtime.Poller[VolumesClientSplitCloneFromParentResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.splitCloneFromParent(ctx, resourceGroupName, accountName, poolName, volumeName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumesClientSplitCloneFromParentResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VolumesClientSplitCloneFromParentResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// SplitCloneFromParent - Split operation to convert clone volume to an independent volume. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-05-01-preview +func (client *VolumesClient) splitCloneFromParent(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginSplitCloneFromParentOptions) (*http.Response, error) { + var err error + const operationName = "VolumesClient.BeginSplitCloneFromParent" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.splitCloneFromParentCreateRequest(ctx, resourceGroupName, accountName, poolName, volumeName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// splitCloneFromParentCreateRequest creates the SplitCloneFromParent request. +func (client *VolumesClient) splitCloneFromParentCreateRequest(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, options *VolumesClientBeginSplitCloneFromParentOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/splitCloneFromParent" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if poolName == "" { + return nil, errors.New("parameter poolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{poolName}", url.PathEscape(poolName)) + if volumeName == "" { + return nil, errors.New("parameter volumeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{volumeName}", url.PathEscape(volumeName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-05-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + // BeginUpdate - Patch the specified volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - accountName - The name of the NetApp account // - poolName - The name of the capacity pool @@ -1877,7 +1964,7 @@ func (client *VolumesClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Patch the specified volume // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-05-01-preview func (client *VolumesClient) update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumePatch, options *VolumesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VolumesClient.BeginUpdate" @@ -1927,7 +2014,7 @@ func (client *VolumesClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/netapp/armnetapp/volumes_client_example_test.go b/sdk/resourcemanager/netapp/armnetapp/volumes_client_example_test.go index 03e6d9c2b51a..e85b9c743e3a 100644 --- a/sdk/resourcemanager/netapp/armnetapp/volumes_client_example_test.go +++ b/sdk/resourcemanager/netapp/armnetapp/volumes_client_example_test.go @@ -15,10 +15,10 @@ import ( "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/netapp/armnetapp/v5" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/netapp/armnetapp/v6" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_List.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_List.json func ExampleVolumesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -48,6 +48,7 @@ func ExampleVolumesClient_NewListPager() { // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1"), // Location: to.Ptr("eastus"), // Properties: &armnetapp.VolumeProperties{ + // ActualThroughputMibps: to.Ptr[float32](128), // CreationToken: to.Ptr("some-amazing-filepath"), // FileSystemID: to.Ptr("9760acf5-4638-11e7-9bdb-020073ca7778"), // NetworkFeatures: to.Ptr(armnetapp.NetworkFeaturesStandard), @@ -56,7 +57,7 @@ func ExampleVolumesClient_NewListPager() { // ServiceLevel: to.Ptr(armnetapp.ServiceLevelPremium), // StorageToNetworkProximity: to.Ptr(armnetapp.VolumeStorageToNetworkProximityT2), // SubnetID: to.Ptr("/subscriptions/9760acf5-4638-11e7-9bdb-020073ca7778/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3"), - // ThroughputMibps: to.Ptr[float32](128), + // ThroughputMibps: to.Ptr[float32](0), // UsageThreshold: to.Ptr[int64](107374182400), // }, // }}, @@ -64,7 +65,7 @@ func ExampleVolumesClient_NewListPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_Get.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_Get.json func ExampleVolumesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -88,6 +89,7 @@ func ExampleVolumesClient_Get() { // ID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRG/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1"), // Location: to.Ptr("eastus"), // Properties: &armnetapp.VolumeProperties{ + // ActualThroughputMibps: to.Ptr[float32](128), // CreationToken: to.Ptr("some-amazing-filepath"), // FileSystemID: to.Ptr("9760acf5-4638-11e7-9bdb-020073ca7778"), // NetworkFeatures: to.Ptr(armnetapp.NetworkFeaturesStandard), @@ -96,13 +98,13 @@ func ExampleVolumesClient_Get() { // ServiceLevel: to.Ptr(armnetapp.ServiceLevelPremium), // StorageToNetworkProximity: to.Ptr(armnetapp.VolumeStorageToNetworkProximityT2), // SubnetID: to.Ptr("/subscriptions/9760acf5-4638-11e7-9bdb-020073ca7778/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3"), - // ThroughputMibps: to.Ptr[float32](128), + // ThroughputMibps: to.Ptr[float32](0), // UsageThreshold: to.Ptr[int64](107374182400), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_CreateOrUpdate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_CreateOrUpdate.json func ExampleVolumesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -116,10 +118,12 @@ func ExampleVolumesClient_BeginCreateOrUpdate() { poller, err := clientFactory.NewVolumesClient().BeginCreateOrUpdate(ctx, "myRG", "account1", "pool1", "volume1", armnetapp.Volume{ Location: to.Ptr("eastus"), Properties: &armnetapp.VolumeProperties{ - CreationToken: to.Ptr("my-unique-file-path"), - ServiceLevel: to.Ptr(armnetapp.ServiceLevelPremium), - SubnetID: to.Ptr("/subscriptions/9760acf5-4638-11e7-9bdb-020073ca7778/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3"), - UsageThreshold: to.Ptr[int64](107374182400), + CreationToken: to.Ptr("my-unique-file-path"), + EncryptionKeySource: to.Ptr(armnetapp.EncryptionKeySourceMicrosoftKeyVault), + ServiceLevel: to.Ptr(armnetapp.ServiceLevelPremium), + SubnetID: to.Ptr("/subscriptions/9760acf5-4638-11e7-9bdb-020073ca7778/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3"), + ThroughputMibps: to.Ptr[float32](128), + UsageThreshold: to.Ptr[int64](107374182400), }, }, nil) if err != nil { @@ -139,7 +143,7 @@ func ExampleVolumesClient_BeginCreateOrUpdate() { // Location: to.Ptr("eastus"), // Properties: &armnetapp.VolumeProperties{ // CreationToken: to.Ptr("some-amazing-filepath"), - // EncryptionKeySource: to.Ptr(armnetapp.EncryptionKeySourceMicrosoftNetApp), + // EncryptionKeySource: to.Ptr(armnetapp.EncryptionKeySourceMicrosoftKeyVault), // FileSystemID: to.Ptr("9760acf5-4638-11e7-9bdb-020073ca7778"), // ProvisioningState: to.Ptr("Succeeded"), // ServiceLevel: to.Ptr(armnetapp.ServiceLevelPremium), @@ -150,7 +154,7 @@ func ExampleVolumesClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_Update.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_Update.json func ExampleVolumesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -161,7 +165,18 @@ func ExampleVolumesClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewVolumesClient().BeginUpdate(ctx, "myRG", "account1", "pool1", "volume1", armnetapp.VolumePatch{}, nil) + poller, err := clientFactory.NewVolumesClient().BeginUpdate(ctx, "myRG", "account1", "pool1", "volume1", armnetapp.VolumePatch{ + Location: to.Ptr("eastus"), + Properties: &armnetapp.VolumePatchProperties{ + DataProtection: &armnetapp.VolumePatchPropertiesDataProtection{ + Backup: &armnetapp.VolumeBackupProperties{ + BackupEnabled: to.Ptr(true), + BackupVaultID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRP/providers/Microsoft.NetApp/netAppAccounts/account1/backupVaults/backupVault1"), + PolicyEnforced: to.Ptr(false), + }, + }, + }, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -178,8 +193,14 @@ func ExampleVolumesClient_BeginUpdate() { // ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1"), // Location: to.Ptr("eastus"), // Properties: &armnetapp.VolumeProperties{ + // ActualThroughputMibps: to.Ptr[float32](128), // CreationToken: to.Ptr("some-amazing-filepath"), // DataProtection: &armnetapp.VolumePropertiesDataProtection{ + // Backup: &armnetapp.VolumeBackupProperties{ + // BackupEnabled: to.Ptr(true), + // BackupVaultID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRP/providers/Microsoft.NetApp/netAppAccounts/account1/backupVaults/backupVault1"), + // PolicyEnforced: to.Ptr(false), + // }, // Snapshot: &armnetapp.VolumeSnapshotProperties{ // SnapshotPolicyID: to.Ptr("/subscriptions/D633CC2E-722B-4AE1-B636-BBD9E4C60ED9/resourceGroups/myRP/providers/Microsoft.NetApp/netAppAccounts/account1/snapshotPolicies/snapshotPolicy1"), // }, @@ -191,13 +212,13 @@ func ExampleVolumesClient_BeginUpdate() { // ServiceLevel: to.Ptr(armnetapp.ServiceLevelPremium), // StorageToNetworkProximity: to.Ptr(armnetapp.VolumeStorageToNetworkProximityT2), // SubnetID: to.Ptr("/subscriptions/9760acf5-4638-11e7-9bdb-020073ca7778/resourceGroups/myRP/providers/Microsoft.Network/virtualNetworks/testvnet3/subnets/testsubnet3"), - // ThroughputMibps: to.Ptr[float32](128), + // ThroughputMibps: to.Ptr[float32](0), // UsageThreshold: to.Ptr[int64](107374182400), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_Delete.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_Delete.json func ExampleVolumesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -218,7 +239,7 @@ func ExampleVolumesClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_PopulateAvailabilityZones.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_PopulateAvailabilityZones.json func ExampleVolumesClient_BeginPopulateAvailabilityZone() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -260,7 +281,7 @@ func ExampleVolumesClient_BeginPopulateAvailabilityZone() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_Revert.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_Revert.json func ExampleVolumesClient_BeginRevert() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -283,7 +304,7 @@ func ExampleVolumesClient_BeginRevert() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_ResetCifsPassword.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_ResetCifsPassword.json func ExampleVolumesClient_BeginResetCifsPassword() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -304,7 +325,28 @@ func ExampleVolumesClient_BeginResetCifsPassword() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_BreakFileLocks.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_SplitClone.json +func ExampleVolumesClient_BeginSplitCloneFromParent() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armnetapp.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewVolumesClient().BeginSplitCloneFromParent(ctx, "myRG", "account1", "pool1", "volume1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_BreakFileLocks.json func ExampleVolumesClient_BeginBreakFileLocks() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -329,7 +371,7 @@ func ExampleVolumesClient_BeginBreakFileLocks() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/GroupIdListForLDAPUser.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/GroupIdListForLDAPUser.json func ExampleVolumesClient_BeginListGetGroupIDListForLdapUser() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -360,7 +402,7 @@ func ExampleVolumesClient_BeginListGetGroupIDListForLdapUser() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_BreakReplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_BreakReplication.json func ExampleVolumesClient_BeginBreakReplication() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -384,7 +426,7 @@ func ExampleVolumesClient_BeginBreakReplication() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_ReestablishReplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_ReestablishReplication.json func ExampleVolumesClient_BeginReestablishReplication() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -407,7 +449,7 @@ func ExampleVolumesClient_BeginReestablishReplication() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_ReplicationStatus.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_ReplicationStatus.json func ExampleVolumesClient_ReplicationStatus() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -434,7 +476,7 @@ func ExampleVolumesClient_ReplicationStatus() { // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_ListReplications.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_ListReplications.json func ExampleVolumesClient_NewListReplicationsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -467,7 +509,7 @@ func ExampleVolumesClient_NewListReplicationsPager() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_ResyncReplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_ResyncReplication.json func ExampleVolumesClient_BeginResyncReplication() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -488,7 +530,7 @@ func ExampleVolumesClient_BeginResyncReplication() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_DeleteReplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_DeleteReplication.json func ExampleVolumesClient_BeginDeleteReplication() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -509,7 +551,7 @@ func ExampleVolumesClient_BeginDeleteReplication() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_AuthorizeReplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_AuthorizeReplication.json func ExampleVolumesClient_BeginAuthorizeReplication() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -532,7 +574,7 @@ func ExampleVolumesClient_BeginAuthorizeReplication() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_ReInitializeReplication.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_ReInitializeReplication.json func ExampleVolumesClient_BeginReInitializeReplication() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -553,7 +595,7 @@ func ExampleVolumesClient_BeginReInitializeReplication() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_PoolChange.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_PoolChange.json func ExampleVolumesClient_BeginPoolChange() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -576,7 +618,7 @@ func ExampleVolumesClient_BeginPoolChange() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_Relocate.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_Relocate.json func ExampleVolumesClient_BeginRelocate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -597,7 +639,7 @@ func ExampleVolumesClient_BeginRelocate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_FinalizeRelocation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_FinalizeRelocation.json func ExampleVolumesClient_BeginFinalizeRelocation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -618,7 +660,7 @@ func ExampleVolumesClient_BeginFinalizeRelocation() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/netapp/resource-manager/Microsoft.NetApp/stable/2023-05-01/examples/Volumes_RevertRelocation.json +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/639ecfad68419328658bd4cfe7094af4ce472be2/specification/netapp/resource-manager/Microsoft.NetApp/preview/2023-05-01-preview/examples/Volumes_RevertRelocation.json func ExampleVolumesClient_BeginRevertRelocation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil {