diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md b/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md index 128136bcbe80..16dd82c71af9 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md +++ b/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md @@ -1,38 +1,36 @@ # Release History -## 2.0.0-beta.1 (2023-01-13) +## 2.0.0 (2023-01-24) ### Breaking Changes -- Type of `ResourceGuard.ProvisioningState` has been changed from `*ProvisioningState` to `*ResourceGuardProvisioningState` +- Function `*ResourceGuardsClient.Patch` parameter(s) have been changed from `(context.Context, string, string, PatchResourceRequestInput, *ResourceGuardsClientPatchOptions)` to `(context.Context, string, string, PatchResourceGuardInput, *ResourceGuardsClientPatchOptions)` +- Type of `ErrorAdditionalInfo.Info` has been changed from `interface{}` to `any` +- Const `StorageSettingStoreTypesSnapshotStore` from type alias `StorageSettingStoreTypes` has been removed +- Operation `*BackupVaultsClient.Delete` has been changed to LRO, use `*BackupVaultsClient.BeginDelete` instead. +- Struct `CloudError` has been removed +- Field `Identity` of struct `ResourceGuardResource` has been removed ### Features Added +- New value `SourceDataStoreTypeOperationalStore` added to type alias `SourceDataStoreType` +- New value `StorageSettingStoreTypesOperationalStore` added to type alias `StorageSettingStoreTypes` - New value `StorageSettingTypesZoneRedundant` added to type alias `StorageSettingTypes` +- New type alias `CrossSubscriptionRestoreState` with values `CrossSubscriptionRestoreStateDisabled`, `CrossSubscriptionRestoreStateEnabled`, `CrossSubscriptionRestoreStatePermanentlyDisabled` - New type alias `ExistingResourcePolicy` with values `ExistingResourcePolicyPatch`, `ExistingResourcePolicySkip` - New type alias `ImmutabilityState` with values `ImmutabilityStateDisabled`, `ImmutabilityStateLocked`, `ImmutabilityStateUnlocked` - New type alias `PersistentVolumeRestoreMode` with values `PersistentVolumeRestoreModeRestoreWithVolumeData`, `PersistentVolumeRestoreModeRestoreWithoutVolumeData` -- New type alias `ResourceGuardProvisioningState` with values `ResourceGuardProvisioningStateFailed`, `ResourceGuardProvisioningStateProvisioning`, `ResourceGuardProvisioningStateSucceeded`, `ResourceGuardProvisioningStateUnknown`, `ResourceGuardProvisioningStateUpdating` - New type alias `SoftDeleteState` with values `SoftDeleteStateAlwaysOn`, `SoftDeleteStateOff`, `SoftDeleteStateOn` - New function `*BackupDatasourceParameters.GetBackupDatasourceParameters() *BackupDatasourceParameters` -- New function `NewBackupInstancesExtensionRoutingClient(azcore.TokenCredential, *arm.ClientOptions) (*BackupInstancesExtensionRoutingClient, error)` -- New function `*BackupInstancesExtensionRoutingClient.NewListPager(string, *BackupInstancesExtensionRoutingClientListOptions) *runtime.Pager[BackupInstancesExtensionRoutingClientListResponse]` - New function `*BlobBackupDatasourceParameters.GetBackupDatasourceParameters() *BackupDatasourceParameters` - New function `NewDeletedBackupInstancesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DeletedBackupInstancesClient, error)` - New function `*DeletedBackupInstancesClient.Get(context.Context, string, string, string, *DeletedBackupInstancesClientGetOptions) (DeletedBackupInstancesClientGetResponse, error)` - New function `*DeletedBackupInstancesClient.NewListPager(string, string, *DeletedBackupInstancesClientListOptions) *runtime.Pager[DeletedBackupInstancesClientListResponse]` - New function `*DeletedBackupInstancesClient.BeginUndelete(context.Context, string, string, string, *DeletedBackupInstancesClientBeginUndeleteOptions) (*runtime.Poller[DeletedBackupInstancesClientUndeleteResponse], error)` -- New function `NewDppResourceGuardProxyClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DppResourceGuardProxyClient, error)` -- New function `*DppResourceGuardProxyClient.Delete(context.Context, string, string, string, *DppResourceGuardProxyClientDeleteOptions) (DppResourceGuardProxyClientDeleteResponse, error)` -- New function `*DppResourceGuardProxyClient.Get(context.Context, string, string, string, *DppResourceGuardProxyClientGetOptions) (DppResourceGuardProxyClientGetResponse, error)` -- New function `*DppResourceGuardProxyClient.NewListPager(string, string, *DppResourceGuardProxyClientListOptions) *runtime.Pager[DppResourceGuardProxyClientListResponse]` -- New function `*DppResourceGuardProxyClient.Put(context.Context, string, string, string, ResourceGuardProxyBaseResource, *DppResourceGuardProxyClientPutOptions) (DppResourceGuardProxyClientPutResponse, error)` -- New function `*DppResourceGuardProxyClient.UnlockDelete(context.Context, string, string, string, UnlockDeleteRequest, *DppResourceGuardProxyClientUnlockDeleteOptions) (DppResourceGuardProxyClientUnlockDeleteResponse, error)` - New function `*ItemPathBasedRestoreCriteria.GetItemLevelRestoreCriteria() *ItemLevelRestoreCriteria` - New function `*KubernetesClusterBackupDatasourceParameters.GetBackupDatasourceParameters() *BackupDatasourceParameters` - New function `*KubernetesClusterRestoreCriteria.GetItemLevelRestoreCriteria() *ItemLevelRestoreCriteria` -- New struct `BackupInstancesExtensionRoutingClient` -- New struct `BackupInstancesExtensionRoutingClientListResponse` - New struct `BlobBackupDatasourceParameters` +- New struct `CrossSubscriptionRestoreSettings` - New struct `DeletedBackupInstance` - New struct `DeletedBackupInstanceResource` - New struct `DeletedBackupInstanceResourceList` @@ -40,26 +38,25 @@ - New struct `DeletedBackupInstancesClientListResponse` - New struct `DeletedBackupInstancesClientUndeleteResponse` - New struct `DeletionInfo` +- New struct `DppBaseTrackedResource` - New struct `DppProxyResource` -- New struct `DppResourceGuardProxyClient` -- New struct `DppResourceGuardProxyClientListResponse` +- New struct `FeatureSettings` - New struct `ImmutabilitySettings` - New struct `ItemPathBasedRestoreCriteria` - New struct `KubernetesClusterBackupDatasourceParameters` - New struct `KubernetesClusterRestoreCriteria` -- New struct `ResourceGuardOperationDetail` -- New struct `ResourceGuardProxyBase` -- New struct `ResourceGuardProxyBaseResource` -- New struct `ResourceGuardProxyBaseResourceList` +- New struct `PatchResourceGuardInput` - New struct `SecuritySettings` - New struct `SoftDeleteSettings` -- New struct `UnlockDeleteRequest` -- New struct `UnlockDeleteResponse` +- New field `ExpiryTime` in struct `AzureBackupDiscreteRecoveryPoint` - New field `Tags` in struct `BackupInstanceResource` +- New field `FeatureSettings` in struct `BackupVault` - New field `IsVaultProtectedByResourceGuard` in struct `BackupVault` - New field `SecuritySettings` in struct `BackupVault` +- New field `FeatureSettings` in struct `PatchBackupVaultInput` - New field `SecuritySettings` in struct `PatchBackupVaultInput` - New field `BackupDatasourceParametersList` in struct `PolicyParameters` +- New field `TargetResourceArmID` in struct `TargetDetails` ## 1.0.0 (2022-05-18) diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/autorest.md b/sdk/resourcemanager/dataprotection/armdataprotection/autorest.md index 73f95b97a638..a993cfb810d0 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/autorest.md +++ b/sdk/resourcemanager/dataprotection/armdataprotection/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/3f36931e7edfce60595fd5558a722e0230a44eb1/specification/dataprotection/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/3f36931e7edfce60595fd5558a722e0230a44eb1/specification/dataprotection/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/dataprotection/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/dataprotection/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.0.0-beta.1 -tag: package-preview-2022-11 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client.go index 1bead20c45ea..7c34897ad19f 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client.go @@ -32,9 +32,9 @@ type BackupInstancesClient struct { } // NewBackupInstancesClient creates a new instance of BackupInstancesClient with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewBackupInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupInstancesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,13 +57,14 @@ func NewBackupInstancesClient(subscriptionID string, credential azcore.TokenCred // BeginAdhocBackup - Trigger adhoc backup // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// backupInstanceName - The name of the backup instance -// parameters - Request body for operation -// options - BackupInstancesClientBeginAdhocBackupOptions contains the optional parameters for the BackupInstancesClient.BeginAdhocBackup -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the backup instance. +// - parameters - Request body for operation +// - options - BackupInstancesClientBeginAdhocBackupOptions contains the optional parameters for the BackupInstancesClient.BeginAdhocBackup +// method. func (client *BackupInstancesClient) BeginAdhocBackup(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters TriggerBackupRequest, options *BackupInstancesClientBeginAdhocBackupOptions) (*runtime.Poller[BackupInstancesClientAdhocBackupResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.adhocBackup(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) @@ -78,7 +79,8 @@ func (client *BackupInstancesClient) BeginAdhocBackup(ctx context.Context, resou // AdhocBackup - Trigger adhoc backup // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview +// +// Generated from API version 2023-01-01 func (client *BackupInstancesClient) adhocBackup(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters TriggerBackupRequest, options *BackupInstancesClientBeginAdhocBackupOptions) (*http.Response, error) { req, err := client.adhocBackupCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { @@ -97,9 +99,6 @@ func (client *BackupInstancesClient) adhocBackup(ctx context.Context, resourceGr // adhocBackupCreateRequest creates the AdhocBackup request. func (client *BackupInstancesClient) adhocBackupCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters TriggerBackupRequest, options *BackupInstancesClientBeginAdhocBackupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup" - 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") @@ -118,7 +117,7 @@ func (client *BackupInstancesClient) adhocBackupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -126,13 +125,14 @@ func (client *BackupInstancesClient) adhocBackupCreateRequest(ctx context.Contex // BeginCreateOrUpdate - Create or update a backup instance in a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// backupInstanceName - The name of the backup instance -// parameters - Request body for operation -// options - BackupInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupInstancesClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the backup instance. +// - parameters - Request body for operation +// - options - BackupInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupInstancesClient.BeginCreateOrUpdate +// method. func (client *BackupInstancesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters BackupInstanceResource, options *BackupInstancesClientBeginCreateOrUpdateOptions) (*runtime.Poller[BackupInstancesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) @@ -147,7 +147,8 @@ func (client *BackupInstancesClient) BeginCreateOrUpdate(ctx context.Context, re // CreateOrUpdate - Create or update a backup instance in a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview +// +// Generated from API version 2023-01-01 func (client *BackupInstancesClient) createOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters BackupInstanceResource, options *BackupInstancesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { @@ -166,9 +167,6 @@ func (client *BackupInstancesClient) createOrUpdate(ctx context.Context, resourc // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *BackupInstancesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters BackupInstanceResource, options *BackupInstancesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" - 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") @@ -187,7 +185,7 @@ func (client *BackupInstancesClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -195,12 +193,13 @@ func (client *BackupInstancesClient) createOrUpdateCreateRequest(ctx context.Con // BeginDelete - Delete a backup instance in a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// backupInstanceName - The name of the backup instance -// options - BackupInstancesClientBeginDeleteOptions contains the optional parameters for the BackupInstancesClient.BeginDelete -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the backup instance. +// - options - BackupInstancesClientBeginDeleteOptions contains the optional parameters for the BackupInstancesClient.BeginDelete +// method. func (client *BackupInstancesClient) BeginDelete(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginDeleteOptions) (*runtime.Poller[BackupInstancesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, vaultName, backupInstanceName, options) @@ -215,7 +214,8 @@ func (client *BackupInstancesClient) BeginDelete(ctx context.Context, resourceGr // Delete - Delete a backup instance in a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview +// +// Generated from API version 2023-01-01 func (client *BackupInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { @@ -234,9 +234,6 @@ func (client *BackupInstancesClient) deleteOperation(ctx context.Context, resour // deleteCreateRequest creates the Delete request. func (client *BackupInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" - 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") @@ -255,7 +252,7 @@ func (client *BackupInstancesClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -263,11 +260,12 @@ func (client *BackupInstancesClient) deleteCreateRequest(ctx context.Context, re // Get - Gets a backup instance with name in a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// backupInstanceName - The name of the backup instance -// options - BackupInstancesClientGetOptions contains the optional parameters for the BackupInstancesClient.Get method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the backup instance. +// - options - BackupInstancesClientGetOptions contains the optional parameters for the BackupInstancesClient.Get method. func (client *BackupInstancesClient) Get(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientGetOptions) (BackupInstancesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { @@ -286,9 +284,6 @@ func (client *BackupInstancesClient) Get(ctx context.Context, resourceGroupName // getCreateRequest creates the Get request. func (client *BackupInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" - 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") @@ -307,7 +302,7 @@ func (client *BackupInstancesClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -324,11 +319,13 @@ func (client *BackupInstancesClient) getHandleResponse(resp *http.Response) (Bac // GetBackupInstanceOperationResult - Get result of backup instance creation operation // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - BackupInstancesClientGetBackupInstanceOperationResultOptions contains the optional parameters for the BackupInstancesClient.GetBackupInstanceOperationResult -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the backup instance. +// - options - BackupInstancesClientGetBackupInstanceOperationResultOptions contains the optional parameters for the BackupInstancesClient.GetBackupInstanceOperationResult +// method. func (client *BackupInstancesClient) GetBackupInstanceOperationResult(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, operationID string, options *BackupInstancesClientGetBackupInstanceOperationResultOptions) (BackupInstancesClientGetBackupInstanceOperationResultResponse, error) { req, err := client.getBackupInstanceOperationResultCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, operationID, options) if err != nil { @@ -347,9 +344,6 @@ func (client *BackupInstancesClient) GetBackupInstanceOperationResult(ctx contex // getBackupInstanceOperationResultCreateRequest creates the GetBackupInstanceOperationResult request. func (client *BackupInstancesClient) getBackupInstanceOperationResultCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, operationID string, options *BackupInstancesClientGetBackupInstanceOperationResultOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/operationResults/{operationId}" - 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") @@ -372,7 +366,7 @@ func (client *BackupInstancesClient) getBackupInstanceOperationResultCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -388,10 +382,12 @@ func (client *BackupInstancesClient) getBackupInstanceOperationResultHandleRespo } // NewListPager - Gets a backup instances belonging to a backup vault -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - BackupInstancesClientListOptions contains the optional parameters for the BackupInstancesClient.List method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - options - BackupInstancesClientListOptions contains the optional parameters for the BackupInstancesClient.NewListPager +// method. func (client *BackupInstancesClient) NewListPager(resourceGroupName string, vaultName string, options *BackupInstancesClientListOptions) *runtime.Pager[BackupInstancesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[BackupInstancesClientListResponse]{ More: func(page BackupInstancesClientListResponse) bool { @@ -423,9 +419,6 @@ func (client *BackupInstancesClient) NewListPager(resourceGroupName string, vaul // listCreateRequest creates the List request. func (client *BackupInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *BackupInstancesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances" - 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") @@ -440,7 +433,7 @@ func (client *BackupInstancesClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -457,11 +450,13 @@ func (client *BackupInstancesClient) listHandleResponse(resp *http.Response) (Ba // BeginResumeBackups - This operation will resume backups for backup instance // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - BackupInstancesClientBeginResumeBackupsOptions contains the optional parameters for the BackupInstancesClient.BeginResumeBackups -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the backup instance. +// - options - BackupInstancesClientBeginResumeBackupsOptions contains the optional parameters for the BackupInstancesClient.BeginResumeBackups +// method. func (client *BackupInstancesClient) BeginResumeBackups(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginResumeBackupsOptions) (*runtime.Poller[BackupInstancesClientResumeBackupsResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.resumeBackups(ctx, resourceGroupName, vaultName, backupInstanceName, options) @@ -476,7 +471,8 @@ func (client *BackupInstancesClient) BeginResumeBackups(ctx context.Context, res // ResumeBackups - This operation will resume backups for backup instance // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview +// +// Generated from API version 2023-01-01 func (client *BackupInstancesClient) resumeBackups(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginResumeBackupsOptions) (*http.Response, error) { req, err := client.resumeBackupsCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { @@ -495,9 +491,6 @@ func (client *BackupInstancesClient) resumeBackups(ctx context.Context, resource // resumeBackupsCreateRequest creates the ResumeBackups request. func (client *BackupInstancesClient) resumeBackupsCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginResumeBackupsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups" - 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") @@ -516,7 +509,7 @@ func (client *BackupInstancesClient) resumeBackupsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -524,11 +517,13 @@ func (client *BackupInstancesClient) resumeBackupsCreateRequest(ctx context.Cont // BeginResumeProtection - This operation will resume protection for a stopped backup instance // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - BackupInstancesClientBeginResumeProtectionOptions contains the optional parameters for the BackupInstancesClient.BeginResumeProtection -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the backup instance. +// - options - BackupInstancesClientBeginResumeProtectionOptions contains the optional parameters for the BackupInstancesClient.BeginResumeProtection +// method. func (client *BackupInstancesClient) BeginResumeProtection(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginResumeProtectionOptions) (*runtime.Poller[BackupInstancesClientResumeProtectionResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.resumeProtection(ctx, resourceGroupName, vaultName, backupInstanceName, options) @@ -543,7 +538,8 @@ func (client *BackupInstancesClient) BeginResumeProtection(ctx context.Context, // ResumeProtection - This operation will resume protection for a stopped backup instance // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview +// +// Generated from API version 2023-01-01 func (client *BackupInstancesClient) resumeProtection(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginResumeProtectionOptions) (*http.Response, error) { req, err := client.resumeProtectionCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { @@ -562,9 +558,6 @@ func (client *BackupInstancesClient) resumeProtection(ctx context.Context, resou // resumeProtectionCreateRequest creates the ResumeProtection request. func (client *BackupInstancesClient) resumeProtectionCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginResumeProtectionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection" - 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") @@ -583,7 +576,7 @@ func (client *BackupInstancesClient) resumeProtectionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -591,11 +584,13 @@ func (client *BackupInstancesClient) resumeProtectionCreateRequest(ctx context.C // BeginStopProtection - This operation will stop protection of a backup instance and data will be held forever // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - BackupInstancesClientBeginStopProtectionOptions contains the optional parameters for the BackupInstancesClient.BeginStopProtection -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the backup instance. +// - options - BackupInstancesClientBeginStopProtectionOptions contains the optional parameters for the BackupInstancesClient.BeginStopProtection +// method. func (client *BackupInstancesClient) BeginStopProtection(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginStopProtectionOptions) (*runtime.Poller[BackupInstancesClientStopProtectionResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.stopProtection(ctx, resourceGroupName, vaultName, backupInstanceName, options) @@ -610,7 +605,8 @@ func (client *BackupInstancesClient) BeginStopProtection(ctx context.Context, re // StopProtection - This operation will stop protection of a backup instance and data will be held forever // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview +// +// Generated from API version 2023-01-01 func (client *BackupInstancesClient) stopProtection(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginStopProtectionOptions) (*http.Response, error) { req, err := client.stopProtectionCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { @@ -629,9 +625,6 @@ func (client *BackupInstancesClient) stopProtection(ctx context.Context, resourc // stopProtectionCreateRequest creates the StopProtection request. func (client *BackupInstancesClient) stopProtectionCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginStopProtectionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection" - 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") @@ -650,7 +643,7 @@ func (client *BackupInstancesClient) stopProtectionCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -659,11 +652,13 @@ func (client *BackupInstancesClient) stopProtectionCreateRequest(ctx context.Con // BeginSuspendBackups - This operation will stop backup for a backup instance and retains the backup data as per the policy // (except latest Recovery point, which will be retained forever) // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - BackupInstancesClientBeginSuspendBackupsOptions contains the optional parameters for the BackupInstancesClient.BeginSuspendBackups -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the backup instance. +// - options - BackupInstancesClientBeginSuspendBackupsOptions contains the optional parameters for the BackupInstancesClient.BeginSuspendBackups +// method. func (client *BackupInstancesClient) BeginSuspendBackups(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginSuspendBackupsOptions) (*runtime.Poller[BackupInstancesClientSuspendBackupsResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.suspendBackups(ctx, resourceGroupName, vaultName, backupInstanceName, options) @@ -679,7 +674,8 @@ func (client *BackupInstancesClient) BeginSuspendBackups(ctx context.Context, re // SuspendBackups - This operation will stop backup for a backup instance and retains the backup data as per the policy (except // latest Recovery point, which will be retained forever) // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview +// +// Generated from API version 2023-01-01 func (client *BackupInstancesClient) suspendBackups(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginSuspendBackupsOptions) (*http.Response, error) { req, err := client.suspendBackupsCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { @@ -698,9 +694,6 @@ func (client *BackupInstancesClient) suspendBackups(ctx context.Context, resourc // suspendBackupsCreateRequest creates the SuspendBackups request. func (client *BackupInstancesClient) suspendBackupsCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginSuspendBackupsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups" - 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") @@ -719,7 +712,7 @@ func (client *BackupInstancesClient) suspendBackupsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -728,12 +721,14 @@ func (client *BackupInstancesClient) suspendBackupsCreateRequest(ctx context.Con // BeginSyncBackupInstance - Sync backup instance again in case of failure This action will retry last failed operation and // will bring backup instance to valid state // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// parameters - Request body for operation -// options - BackupInstancesClientBeginSyncBackupInstanceOptions contains the optional parameters for the BackupInstancesClient.BeginSyncBackupInstance -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the backup instance. +// - parameters - Request body for operation +// - options - BackupInstancesClientBeginSyncBackupInstanceOptions contains the optional parameters for the BackupInstancesClient.BeginSyncBackupInstance +// method. func (client *BackupInstancesClient) BeginSyncBackupInstance(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters SyncBackupInstanceRequest, options *BackupInstancesClientBeginSyncBackupInstanceOptions) (*runtime.Poller[BackupInstancesClientSyncBackupInstanceResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.syncBackupInstance(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) @@ -749,7 +744,8 @@ func (client *BackupInstancesClient) BeginSyncBackupInstance(ctx context.Context // SyncBackupInstance - Sync backup instance again in case of failure This action will retry last failed operation and will // bring backup instance to valid state // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview +// +// Generated from API version 2023-01-01 func (client *BackupInstancesClient) syncBackupInstance(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters SyncBackupInstanceRequest, options *BackupInstancesClientBeginSyncBackupInstanceOptions) (*http.Response, error) { req, err := client.syncBackupInstanceCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { @@ -768,9 +764,6 @@ func (client *BackupInstancesClient) syncBackupInstance(ctx context.Context, res // syncBackupInstanceCreateRequest creates the SyncBackupInstance request. func (client *BackupInstancesClient) syncBackupInstanceCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters SyncBackupInstanceRequest, options *BackupInstancesClientBeginSyncBackupInstanceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync" - 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") @@ -789,7 +782,7 @@ func (client *BackupInstancesClient) syncBackupInstanceCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -797,12 +790,14 @@ func (client *BackupInstancesClient) syncBackupInstanceCreateRequest(ctx context // BeginTriggerRehydrate - rehydrate recovery point for restore for a BackupInstance // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// parameters - Request body for operation -// options - BackupInstancesClientBeginTriggerRehydrateOptions contains the optional parameters for the BackupInstancesClient.BeginTriggerRehydrate -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the backup instance. +// - parameters - Request body for operation +// - options - BackupInstancesClientBeginTriggerRehydrateOptions contains the optional parameters for the BackupInstancesClient.BeginTriggerRehydrate +// method. func (client *BackupInstancesClient) BeginTriggerRehydrate(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupRehydrationRequest, options *BackupInstancesClientBeginTriggerRehydrateOptions) (*runtime.Poller[BackupInstancesClientTriggerRehydrateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.triggerRehydrate(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) @@ -817,7 +812,8 @@ func (client *BackupInstancesClient) BeginTriggerRehydrate(ctx context.Context, // TriggerRehydrate - rehydrate recovery point for restore for a BackupInstance // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview +// +// Generated from API version 2023-01-01 func (client *BackupInstancesClient) triggerRehydrate(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupRehydrationRequest, options *BackupInstancesClientBeginTriggerRehydrateOptions) (*http.Response, error) { req, err := client.triggerRehydrateCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { @@ -840,9 +836,6 @@ func (client *BackupInstancesClient) triggerRehydrateCreateRequest(ctx context.C return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if vaultName == "" { return nil, errors.New("parameter vaultName cannot be empty") @@ -857,7 +850,7 @@ func (client *BackupInstancesClient) triggerRehydrateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -865,13 +858,14 @@ func (client *BackupInstancesClient) triggerRehydrateCreateRequest(ctx context.C // BeginTriggerRestore - Triggers restore for a BackupInstance // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// backupInstanceName - The name of the backup instance -// parameters - Request body for operation -// options - BackupInstancesClientBeginTriggerRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginTriggerRestore -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the backup instance. +// - parameters - Request body for operation +// - options - BackupInstancesClientBeginTriggerRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginTriggerRestore +// method. func (client *BackupInstancesClient) BeginTriggerRestore(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupRestoreRequestClassification, options *BackupInstancesClientBeginTriggerRestoreOptions) (*runtime.Poller[BackupInstancesClientTriggerRestoreResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.triggerRestore(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) @@ -886,7 +880,8 @@ func (client *BackupInstancesClient) BeginTriggerRestore(ctx context.Context, re // TriggerRestore - Triggers restore for a BackupInstance // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview +// +// Generated from API version 2023-01-01 func (client *BackupInstancesClient) triggerRestore(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupRestoreRequestClassification, options *BackupInstancesClientBeginTriggerRestoreOptions) (*http.Response, error) { req, err := client.triggerRestoreCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { @@ -905,9 +900,6 @@ func (client *BackupInstancesClient) triggerRestore(ctx context.Context, resourc // triggerRestoreCreateRequest creates the TriggerRestore request. func (client *BackupInstancesClient) triggerRestoreCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupRestoreRequestClassification, options *BackupInstancesClientBeginTriggerRestoreOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore" - 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") @@ -926,7 +918,7 @@ func (client *BackupInstancesClient) triggerRestoreCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -934,12 +926,13 @@ func (client *BackupInstancesClient) triggerRestoreCreateRequest(ctx context.Con // BeginValidateForBackup - Validate whether adhoc backup will be successful or not // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// parameters - Request body for operation -// options - BackupInstancesClientBeginValidateForBackupOptions contains the optional parameters for the BackupInstancesClient.BeginValidateForBackup -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - parameters - Request body for operation +// - options - BackupInstancesClientBeginValidateForBackupOptions contains the optional parameters for the BackupInstancesClient.BeginValidateForBackup +// method. func (client *BackupInstancesClient) BeginValidateForBackup(ctx context.Context, resourceGroupName string, vaultName string, parameters ValidateForBackupRequest, options *BackupInstancesClientBeginValidateForBackupOptions) (*runtime.Poller[BackupInstancesClientValidateForBackupResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.validateForBackup(ctx, resourceGroupName, vaultName, parameters, options) @@ -954,7 +947,8 @@ func (client *BackupInstancesClient) BeginValidateForBackup(ctx context.Context, // ValidateForBackup - Validate whether adhoc backup will be successful or not // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview +// +// Generated from API version 2023-01-01 func (client *BackupInstancesClient) validateForBackup(ctx context.Context, resourceGroupName string, vaultName string, parameters ValidateForBackupRequest, options *BackupInstancesClientBeginValidateForBackupOptions) (*http.Response, error) { req, err := client.validateForBackupCreateRequest(ctx, resourceGroupName, vaultName, parameters, options) if err != nil { @@ -973,9 +967,6 @@ func (client *BackupInstancesClient) validateForBackup(ctx context.Context, reso // validateForBackupCreateRequest creates the ValidateForBackup request. func (client *BackupInstancesClient) validateForBackupCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, parameters ValidateForBackupRequest, options *BackupInstancesClientBeginValidateForBackupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup" - 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") @@ -990,7 +981,7 @@ func (client *BackupInstancesClient) validateForBackupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -998,13 +989,14 @@ func (client *BackupInstancesClient) validateForBackupCreateRequest(ctx context. // BeginValidateForRestore - Validates if Restore can be triggered for a DataSource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// backupInstanceName - The name of the backup instance -// parameters - Request body for operation -// options - BackupInstancesClientBeginValidateForRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginValidateForRestore -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the backup instance. +// - parameters - Request body for operation +// - options - BackupInstancesClientBeginValidateForRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginValidateForRestore +// method. func (client *BackupInstancesClient) BeginValidateForRestore(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters ValidateRestoreRequestObject, options *BackupInstancesClientBeginValidateForRestoreOptions) (*runtime.Poller[BackupInstancesClientValidateForRestoreResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.validateForRestore(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) @@ -1019,7 +1011,8 @@ func (client *BackupInstancesClient) BeginValidateForRestore(ctx context.Context // ValidateForRestore - Validates if Restore can be triggered for a DataSource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview +// +// Generated from API version 2023-01-01 func (client *BackupInstancesClient) validateForRestore(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters ValidateRestoreRequestObject, options *BackupInstancesClientBeginValidateForRestoreOptions) (*http.Response, error) { req, err := client.validateForRestoreCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { @@ -1038,9 +1031,6 @@ func (client *BackupInstancesClient) validateForRestore(ctx context.Context, res // validateForRestoreCreateRequest creates the ValidateForRestore request. func (client *BackupInstancesClient) validateForRestoreCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters ValidateRestoreRequestObject, options *BackupInstancesClientBeginValidateForRestoreOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore" - 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") @@ -1059,7 +1049,7 @@ func (client *BackupInstancesClient) validateForRestoreCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client_example_test.go deleted file mode 100644 index 10f503a96825..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client_example_test.go +++ /dev/null @@ -1,596 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_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/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListBackupInstances.json -func ExampleBackupInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("000pikumar", "PratikPrivatePreviewVault1", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetBackupInstance.json -func ExampleBackupInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "000pikumar", "PratikPrivatePreviewVault1", "testInstance1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/PutBackupInstance.json -func ExampleBackupInstancesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "000pikumar", "PratikPrivatePreviewVault1", "testInstance1", armdataprotection.BackupInstanceResource{ - Tags: map[string]*string{ - "key1": to.Ptr("val1"), - }, - Properties: &armdataprotection.BackupInstance{ - DataSourceInfo: &armdataprotection.Datasource{ - DatasourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - ObjectType: to.Ptr("Datasource"), - ResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb"), - ResourceLocation: to.Ptr(""), - ResourceName: to.Ptr("testdb"), - ResourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - ResourceURI: to.Ptr(""), - }, - DataSourceSetInfo: &armdataprotection.DatasourceSet{ - DatasourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - ObjectType: to.Ptr("DatasourceSet"), - ResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest"), - ResourceLocation: to.Ptr(""), - ResourceName: to.Ptr("viveksipgtest"), - ResourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - ResourceURI: to.Ptr(""), - }, - DatasourceAuthCredentials: &armdataprotection.SecretStoreBasedAuthCredentials{ - ObjectType: to.Ptr("SecretStoreBasedAuthCredentials"), - SecretStoreResource: &armdataprotection.SecretStoreResource{ - SecretStoreType: to.Ptr(armdataprotection.SecretStoreTypeAzureKeyVault), - URI: to.Ptr("https://samplevault.vault.azure.net/secrets/credentials"), - }, - }, - FriendlyName: to.Ptr("harshitbi2"), - ObjectType: to.Ptr("BackupInstance"), - PolicyInfo: &armdataprotection.PolicyInfo{ - PolicyID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/Backupvaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1"), - PolicyParameters: &armdataprotection.PolicyParameters{ - DataStoreParametersList: []armdataprotection.DataStoreParametersClassification{ - &armdataprotection.AzureOperationalStoreParameters{ - DataStoreType: to.Ptr(armdataprotection.DataStoreTypesOperationalStore), - ObjectType: to.Ptr("AzureOperationalStoreParameters"), - ResourceGroupID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest"), - }}, - }, - }, - ValidationType: to.Ptr(armdataprotection.ValidationTypeShallowValidation), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/DeleteBackupInstance.json -func ExampleBackupInstancesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "000pikumar", "PratikPrivatePreviewVault1", "testInstance1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerBackup.json -func ExampleBackupInstancesClient_BeginAdhocBackup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginAdhocBackup(ctx, "000pikumar", "PratikPrivatePreviewVault1", "testInstance1", armdataprotection.TriggerBackupRequest{ - BackupRuleOptions: &armdataprotection.AdHocBackupRuleOptions{ - RuleName: to.Ptr("BackupWeekly"), - TriggerOption: &armdataprotection.AdhocBackupTriggerOption{ - RetentionTagOverride: to.Ptr("yearly"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ValidateForBackup.json -func ExampleBackupInstancesClient_BeginValidateForBackup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginValidateForBackup(ctx, "000pikumar", "PratikPrivatePreviewVault1", armdataprotection.ValidateForBackupRequest{ - BackupInstance: &armdataprotection.BackupInstance{ - DataSourceInfo: &armdataprotection.Datasource{ - DatasourceType: to.Ptr("OssDB"), - ObjectType: to.Ptr("Datasource"), - ResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb"), - ResourceLocation: to.Ptr(""), - ResourceName: to.Ptr("testdb"), - ResourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - ResourceURI: to.Ptr(""), - }, - DataSourceSetInfo: &armdataprotection.DatasourceSet{ - DatasourceType: to.Ptr("OssDB"), - ObjectType: to.Ptr("DatasourceSet"), - ResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest"), - ResourceLocation: to.Ptr(""), - ResourceName: to.Ptr("viveksipgtest"), - ResourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - ResourceURI: to.Ptr(""), - }, - DatasourceAuthCredentials: &armdataprotection.SecretStoreBasedAuthCredentials{ - ObjectType: to.Ptr("SecretStoreBasedAuthCredentials"), - SecretStoreResource: &armdataprotection.SecretStoreResource{ - SecretStoreType: to.Ptr(armdataprotection.SecretStoreTypeAzureKeyVault), - URI: to.Ptr("https://samplevault.vault.azure.net/secrets/credentials"), - }, - }, - FriendlyName: to.Ptr("harshitbi2"), - ObjectType: to.Ptr("BackupInstance"), - PolicyInfo: &armdataprotection.PolicyInfo{ - PolicyID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/Backupvaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetBackupInstanceOperationResult.json -func ExampleBackupInstancesClient_GetBackupInstanceOperationResult() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetBackupInstanceOperationResult(ctx, "SampleResourceGroup", "swaggerExample", "testInstance1", "YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA==", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRehydrate.json -func ExampleBackupInstancesClient_BeginTriggerRehydrate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginTriggerRehydrate(ctx, "000pikumar", "PratikPrivatePreviewVault1", "testInstance1", armdataprotection.AzureBackupRehydrationRequest{ - RecoveryPointID: to.Ptr("hardcodedRP"), - RehydrationPriority: to.Ptr(armdataprotection.RehydrationPriorityHigh), - RehydrationRetentionDuration: to.Ptr("7D"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRestore.json -func ExampleBackupInstancesClient_BeginTriggerRestore_triggerRestore() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginTriggerRestore(ctx, "000pikumar", "PratikPrivatePreviewVault1", "testInstance1", &armdataprotection.AzureBackupRecoveryPointBasedRestoreRequest{ - ObjectType: to.Ptr("AzureBackupRecoveryPointBasedRestoreRequest"), - RestoreTargetInfo: &armdataprotection.RestoreTargetInfo{ - ObjectType: to.Ptr("RestoreTargetInfo"), - RecoveryOption: to.Ptr(armdataprotection.RecoveryOptionFailIfExists), - RestoreLocation: to.Ptr("southeastasia"), - DatasourceAuthCredentials: &armdataprotection.SecretStoreBasedAuthCredentials{ - ObjectType: to.Ptr("SecretStoreBasedAuthCredentials"), - SecretStoreResource: &armdataprotection.SecretStoreResource{ - SecretStoreType: to.Ptr(armdataprotection.SecretStoreTypeAzureKeyVault), - URI: to.Ptr("https://samplevault.vault.azure.net/secrets/credentials"), - }, - }, - DatasourceInfo: &armdataprotection.Datasource{ - DatasourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - ObjectType: to.Ptr("Datasource"), - ResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/targetdb"), - ResourceLocation: to.Ptr(""), - ResourceName: to.Ptr("targetdb"), - ResourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - ResourceURI: to.Ptr(""), - }, - DatasourceSetInfo: &armdataprotection.DatasourceSet{ - DatasourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - ObjectType: to.Ptr("DatasourceSet"), - ResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest"), - ResourceLocation: to.Ptr(""), - ResourceName: to.Ptr("viveksipgtest"), - ResourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - ResourceURI: to.Ptr(""), - }, - }, - SourceDataStoreType: to.Ptr(armdataprotection.SourceDataStoreTypeVaultStore), - SourceResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb"), - RecoveryPointID: to.Ptr("hardcodedRP"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRestoreAsFiles.json -func ExampleBackupInstancesClient_BeginTriggerRestore_triggerRestoreAsFiles() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginTriggerRestore(ctx, "000pikumar", "PrivatePreviewVault1", "testInstance1", &armdataprotection.AzureBackupRecoveryPointBasedRestoreRequest{ - ObjectType: to.Ptr("AzureBackupRecoveryPointBasedRestoreRequest"), - RestoreTargetInfo: &armdataprotection.RestoreFilesTargetInfo{ - ObjectType: to.Ptr("RestoreFilesTargetInfo"), - RecoveryOption: to.Ptr(armdataprotection.RecoveryOptionFailIfExists), - RestoreLocation: to.Ptr("southeastasia"), - TargetDetails: &armdataprotection.TargetDetails{ - FilePrefix: to.Ptr("restoredblob"), - RestoreTargetLocationType: to.Ptr(armdataprotection.RestoreTargetLocationTypeAzureBlobs), - URL: to.Ptr("https://teststorage.blob.core.windows.net/restoretest"), - }, - }, - SourceDataStoreType: to.Ptr(armdataprotection.SourceDataStoreTypeVaultStore), - SourceResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb"), - RecoveryPointID: to.Ptr("hardcodedRP"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRestoreWithRehydration.json -func ExampleBackupInstancesClient_BeginTriggerRestore_triggerRestoreWithRehydration() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginTriggerRestore(ctx, "000pikumar", "PratikPrivatePreviewVault1", "testInstance1", &armdataprotection.AzureBackupRestoreWithRehydrationRequest{ - ObjectType: to.Ptr("AzureBackupRestoreWithRehydrationRequest"), - RestoreTargetInfo: &armdataprotection.RestoreTargetInfo{ - ObjectType: to.Ptr("RestoreTargetInfo"), - RecoveryOption: to.Ptr(armdataprotection.RecoveryOptionFailIfExists), - RestoreLocation: to.Ptr("southeastasia"), - DatasourceInfo: &armdataprotection.Datasource{ - DatasourceType: to.Ptr("OssDB"), - ObjectType: to.Ptr("Datasource"), - ResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb"), - ResourceLocation: to.Ptr(""), - ResourceName: to.Ptr("testdb"), - ResourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - ResourceURI: to.Ptr(""), - }, - DatasourceSetInfo: &armdataprotection.DatasourceSet{ - DatasourceType: to.Ptr("OssDB"), - ObjectType: to.Ptr("DatasourceSet"), - ResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest"), - ResourceLocation: to.Ptr(""), - ResourceName: to.Ptr("viveksipgtest"), - ResourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - ResourceURI: to.Ptr(""), - }, - }, - SourceDataStoreType: to.Ptr(armdataprotection.SourceDataStoreTypeVaultStore), - SourceResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb"), - RecoveryPointID: to.Ptr("hardcodedRP"), - RehydrationPriority: to.Ptr(armdataprotection.RehydrationPriorityHigh), - RehydrationRetentionDuration: to.Ptr("7D"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ResumeBackups.json -func ExampleBackupInstancesClient_BeginResumeBackups() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginResumeBackups(ctx, "testrg", "testvault", "testbi", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ResumeProtection.json -func ExampleBackupInstancesClient_BeginResumeProtection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginResumeProtection(ctx, "testrg", "testvault", "testbi", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/StopProtection.json -func ExampleBackupInstancesClient_BeginStopProtection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStopProtection(ctx, "testrg", "testvault", "testbi", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/SuspendBackups.json -func ExampleBackupInstancesClient_BeginSuspendBackups() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginSuspendBackups(ctx, "testrg", "testvault", "testbi", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/SyncBackupInstance.json -func ExampleBackupInstancesClient_BeginSyncBackupInstance() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginSyncBackupInstance(ctx, "testrg", "testvault", "testbi", armdataprotection.SyncBackupInstanceRequest{ - SyncType: to.Ptr(armdataprotection.SyncTypeDefault), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ValidateRestore.json -func ExampleBackupInstancesClient_BeginValidateForRestore() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginValidateForRestore(ctx, "000pikumar", "PratikPrivatePreviewVault1", "testInstance1", armdataprotection.ValidateRestoreRequestObject{ - RestoreRequestObject: &armdataprotection.AzureBackupRecoveryPointBasedRestoreRequest{ - ObjectType: to.Ptr("AzureBackupRecoveryPointBasedRestoreRequest"), - RestoreTargetInfo: &armdataprotection.RestoreTargetInfo{ - ObjectType: to.Ptr("RestoreTargetInfo"), - RecoveryOption: to.Ptr(armdataprotection.RecoveryOptionFailIfExists), - RestoreLocation: to.Ptr("southeastasia"), - DatasourceAuthCredentials: &armdataprotection.SecretStoreBasedAuthCredentials{ - ObjectType: to.Ptr("SecretStoreBasedAuthCredentials"), - SecretStoreResource: &armdataprotection.SecretStoreResource{ - SecretStoreType: to.Ptr(armdataprotection.SecretStoreTypeAzureKeyVault), - URI: to.Ptr("https://samplevault.vault.azure.net/secrets/credentials"), - }, - }, - DatasourceInfo: &armdataprotection.Datasource{ - DatasourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - ObjectType: to.Ptr("Datasource"), - ResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/targetdb"), - ResourceLocation: to.Ptr(""), - ResourceName: to.Ptr("targetdb"), - ResourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - ResourceURI: to.Ptr(""), - }, - DatasourceSetInfo: &armdataprotection.DatasourceSet{ - DatasourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - ObjectType: to.Ptr("DatasourceSet"), - ResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest"), - ResourceLocation: to.Ptr(""), - ResourceName: to.Ptr("viveksipgtest"), - ResourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - ResourceURI: to.Ptr(""), - }, - }, - SourceDataStoreType: to.Ptr(armdataprotection.SourceDataStoreTypeVaultStore), - SourceResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb"), - RecoveryPointID: to.Ptr("hardcodedRP"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backupinstancesextensionrouting_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupinstancesextensionrouting_client.go deleted file mode 100644 index c52ce95c8952..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backupinstancesextensionrouting_client.go +++ /dev/null @@ -1,113 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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" -) - -// BackupInstancesExtensionRoutingClient contains the methods for the BackupInstancesExtensionRouting group. -// Don't use this type directly, use NewBackupInstancesExtensionRoutingClient() instead. -type BackupInstancesExtensionRoutingClient struct { - host string - pl runtime.Pipeline -} - -// NewBackupInstancesExtensionRoutingClient creates a new instance of BackupInstancesExtensionRoutingClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewBackupInstancesExtensionRoutingClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupInstancesExtensionRoutingClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &BackupInstancesExtensionRoutingClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// NewListPager - Gets a list backup instances associated with a tracked resource -// Generated from API version 2022-11-01-preview -// resourceID - ARM path of the resource to be protected using Microsoft.DataProtection -// options - BackupInstancesExtensionRoutingClientListOptions contains the optional parameters for the BackupInstancesExtensionRoutingClient.List -// method. -func (client *BackupInstancesExtensionRoutingClient) NewListPager(resourceID string, options *BackupInstancesExtensionRoutingClientListOptions) *runtime.Pager[BackupInstancesExtensionRoutingClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[BackupInstancesExtensionRoutingClientListResponse]{ - More: func(page BackupInstancesExtensionRoutingClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *BackupInstancesExtensionRoutingClientListResponse) (BackupInstancesExtensionRoutingClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceID, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return BackupInstancesExtensionRoutingClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return BackupInstancesExtensionRoutingClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BackupInstancesExtensionRoutingClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - }) -} - -// listCreateRequest creates the List request. -func (client *BackupInstancesExtensionRoutingClient) listCreateRequest(ctx context.Context, resourceID string, options *BackupInstancesExtensionRoutingClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceId}/providers/Microsoft.DataProtection/backupInstances" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceId}", url.PathEscape(resourceID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-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 *BackupInstancesExtensionRoutingClient) listHandleResponse(resp *http.Response) (BackupInstancesExtensionRoutingClientListResponse, error) { - result := BackupInstancesExtensionRoutingClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.BackupInstanceResourceList); err != nil { - return BackupInstancesExtensionRoutingClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backupinstancesextensionrouting_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupinstancesextensionrouting_client_example_test.go deleted file mode 100644 index bee3fc3de4ec..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backupinstancesextensionrouting_client_example_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListBackupInstancesExtensionRouting.json -func ExampleBackupInstancesExtensionRoutingClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupInstancesExtensionRoutingClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("subscriptions/36d32b25-3dc7-41b0-bde1-397500644591/resourceGroups/testRG/providers/Microsoft.Compute/disks/testDisk", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client.go index 8a380bdd5108..74d37491dbb7 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client.go @@ -32,9 +32,9 @@ type BackupPoliciesClient struct { } // NewBackupPoliciesClient creates a new instance of BackupPoliciesClient with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewBackupPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupPoliciesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,13 +57,14 @@ func NewBackupPoliciesClient(subscriptionID string, credential azcore.TokenCrede // CreateOrUpdate - Creates or Updates a backup policy belonging to a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// backupPolicyName - Name of the policy -// parameters - Request body for operation -// options - BackupPoliciesClientCreateOrUpdateOptions contains the optional parameters for the BackupPoliciesClient.CreateOrUpdate -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupPolicyName - Name of the policy +// - parameters - Request body for operation +// - options - BackupPoliciesClientCreateOrUpdateOptions contains the optional parameters for the BackupPoliciesClient.CreateOrUpdate +// method. func (client *BackupPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, backupPolicyName string, parameters BaseBackupPolicyResource, options *BackupPoliciesClientCreateOrUpdateOptions) (BackupPoliciesClientCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vaultName, backupPolicyName, parameters, options) if err != nil { @@ -82,9 +83,6 @@ func (client *BackupPoliciesClient) CreateOrUpdate(ctx context.Context, resource // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *BackupPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupPolicyName string, parameters BaseBackupPolicyResource, options *BackupPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}" - 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") @@ -103,7 +101,7 @@ func (client *BackupPoliciesClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -120,10 +118,11 @@ func (client *BackupPoliciesClient) createOrUpdateHandleResponse(resp *http.Resp // Delete - Deletes a backup policy belonging to a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - BackupPoliciesClientDeleteOptions contains the optional parameters for the BackupPoliciesClient.Delete method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - options - BackupPoliciesClientDeleteOptions contains the optional parameters for the BackupPoliciesClient.Delete method. func (client *BackupPoliciesClient) Delete(ctx context.Context, resourceGroupName string, vaultName string, backupPolicyName string, options *BackupPoliciesClientDeleteOptions) (BackupPoliciesClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, backupPolicyName, options) if err != nil { @@ -142,9 +141,6 @@ func (client *BackupPoliciesClient) Delete(ctx context.Context, resourceGroupNam // deleteCreateRequest creates the Delete request. func (client *BackupPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupPolicyName string, options *BackupPoliciesClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}" - 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") @@ -163,7 +159,7 @@ func (client *BackupPoliciesClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -171,10 +167,11 @@ func (client *BackupPoliciesClient) deleteCreateRequest(ctx context.Context, res // Get - Gets a backup policy belonging to a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - BackupPoliciesClientGetOptions contains the optional parameters for the BackupPoliciesClient.Get method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - options - BackupPoliciesClientGetOptions contains the optional parameters for the BackupPoliciesClient.Get method. func (client *BackupPoliciesClient) Get(ctx context.Context, resourceGroupName string, vaultName string, backupPolicyName string, options *BackupPoliciesClientGetOptions) (BackupPoliciesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, backupPolicyName, options) if err != nil { @@ -193,9 +190,6 @@ func (client *BackupPoliciesClient) Get(ctx context.Context, resourceGroupName s // getCreateRequest creates the Get request. func (client *BackupPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupPolicyName string, options *BackupPoliciesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}" - 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") @@ -214,7 +208,7 @@ func (client *BackupPoliciesClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -230,10 +224,11 @@ func (client *BackupPoliciesClient) getHandleResponse(resp *http.Response) (Back } // NewListPager - Returns list of backup policies belonging to a backup vault -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - BackupPoliciesClientListOptions contains the optional parameters for the BackupPoliciesClient.List method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - options - BackupPoliciesClientListOptions contains the optional parameters for the BackupPoliciesClient.NewListPager method. func (client *BackupPoliciesClient) NewListPager(resourceGroupName string, vaultName string, options *BackupPoliciesClientListOptions) *runtime.Pager[BackupPoliciesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[BackupPoliciesClientListResponse]{ More: func(page BackupPoliciesClientListResponse) bool { @@ -265,9 +260,6 @@ func (client *BackupPoliciesClient) NewListPager(resourceGroupName string, vault // listCreateRequest creates the List request. func (client *BackupPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *BackupPoliciesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies" - 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") @@ -282,7 +274,7 @@ func (client *BackupPoliciesClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client_example_test.go deleted file mode 100644 index 1d95e52176e7..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client_example_test.go +++ /dev/null @@ -1,180 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/ListBackupPolicy.json -func ExampleBackupPoliciesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupPoliciesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("000pikumar", "PrivatePreviewVault", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/GetBackupPolicy.json -func ExampleBackupPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupPoliciesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "000pikumar", "PrivatePreviewVault", "OSSDBPolicy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json -func ExampleBackupPoliciesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupPoliciesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "000pikumar", "PrivatePreviewVault", "OSSDBPolicy", armdataprotection.BaseBackupPolicyResource{ - Properties: &armdataprotection.BackupPolicy{ - DatasourceTypes: []*string{ - to.Ptr("OssDB")}, - ObjectType: to.Ptr("BackupPolicy"), - PolicyRules: []armdataprotection.BasePolicyRuleClassification{ - &armdataprotection.AzureBackupRule{ - Name: to.Ptr("BackupWeekly"), - ObjectType: to.Ptr("AzureBackupRule"), - BackupParameters: &armdataprotection.AzureBackupParams{ - ObjectType: to.Ptr("AzureBackupParams"), - BackupType: to.Ptr("Full"), - }, - DataStore: &armdataprotection.DataStoreInfoBase{ - DataStoreType: to.Ptr(armdataprotection.DataStoreTypesVaultStore), - ObjectType: to.Ptr("DataStoreInfoBase"), - }, - Trigger: &armdataprotection.ScheduleBasedTriggerContext{ - ObjectType: to.Ptr("ScheduleBasedTriggerContext"), - Schedule: &armdataprotection.BackupSchedule{ - RepeatingTimeIntervals: []*string{ - to.Ptr("R/2019-11-20T08:00:00-08:00/P1W")}, - }, - TaggingCriteria: []*armdataprotection.TaggingCriteria{ - { - IsDefault: to.Ptr(true), - TagInfo: &armdataprotection.RetentionTag{ - TagName: to.Ptr("Default"), - }, - TaggingPriority: to.Ptr[int64](99), - }, - { - Criteria: []armdataprotection.BackupCriteriaClassification{ - &armdataprotection.ScheduleBasedBackupCriteria{ - ObjectType: to.Ptr("ScheduleBasedBackupCriteria"), - DaysOfTheWeek: []*armdataprotection.DayOfWeek{ - to.Ptr(armdataprotection.DayOfWeekSunday)}, - ScheduleTimes: []*time.Time{ - to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T13:00:00Z"); return t }())}, - }}, - IsDefault: to.Ptr(false), - TagInfo: &armdataprotection.RetentionTag{ - TagName: to.Ptr("Weekly"), - }, - TaggingPriority: to.Ptr[int64](20), - }}, - }, - }, - &armdataprotection.AzureRetentionRule{ - Name: to.Ptr("Default"), - ObjectType: to.Ptr("AzureRetentionRule"), - IsDefault: to.Ptr(true), - Lifecycles: []*armdataprotection.SourceLifeCycle{ - { - DeleteAfter: &armdataprotection.AbsoluteDeleteOption{ - Duration: to.Ptr("P1W"), - ObjectType: to.Ptr("AbsoluteDeleteOption"), - }, - SourceDataStore: &armdataprotection.DataStoreInfoBase{ - DataStoreType: to.Ptr(armdataprotection.DataStoreTypesVaultStore), - ObjectType: to.Ptr("DataStoreInfoBase"), - }, - }}, - }, - &armdataprotection.AzureRetentionRule{ - Name: to.Ptr("Weekly"), - ObjectType: to.Ptr("AzureRetentionRule"), - IsDefault: to.Ptr(false), - Lifecycles: []*armdataprotection.SourceLifeCycle{ - { - DeleteAfter: &armdataprotection.AbsoluteDeleteOption{ - Duration: to.Ptr("P12W"), - ObjectType: to.Ptr("AbsoluteDeleteOption"), - }, - SourceDataStore: &armdataprotection.DataStoreInfoBase{ - DataStoreType: to.Ptr(armdataprotection.DataStoreTypesVaultStore), - ObjectType: to.Ptr("DataStoreInfoBase"), - }, - }}, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/DeleteBackupPolicy.json -func ExampleBackupPoliciesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupPoliciesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "000pikumar", "PrivatePreviewVault", "OSSDBPolicy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client.go index d9218e7f7a38..b4398e27d3de 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client.go @@ -33,9 +33,9 @@ type BackupVaultOperationResultsClient struct { } // NewBackupVaultOperationResultsClient creates a new instance of BackupVaultOperationResultsClient with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewBackupVaultOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupVaultOperationResultsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -58,11 +58,12 @@ func NewBackupVaultOperationResultsClient(subscriptionID string, credential azco // Get - // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - BackupVaultOperationResultsClientGetOptions contains the optional parameters for the BackupVaultOperationResultsClient.Get -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - options - BackupVaultOperationResultsClientGetOptions contains the optional parameters for the BackupVaultOperationResultsClient.Get +// method. func (client *BackupVaultOperationResultsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *BackupVaultOperationResultsClientGetOptions) (BackupVaultOperationResultsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, operationID, options) if err != nil { @@ -81,9 +82,6 @@ func (client *BackupVaultOperationResultsClient) Get(ctx context.Context, resour // getCreateRequest creates the Get request. func (client *BackupVaultOperationResultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *BackupVaultOperationResultsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationResults/{operationId}" - 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") @@ -102,7 +100,7 @@ func (client *BackupVaultOperationResultsClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client_example_test.go deleted file mode 100644 index 0fc9819e6b60..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client_example_test.go +++ /dev/null @@ -1,36 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetOperationResultPatch.json -func ExampleBackupVaultOperationResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupVaultOperationResultsClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "SampleResourceGroup", "swaggerExample", "YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA==", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client.go index ebd0f3f6c056..455f97a57bb4 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client.go @@ -32,9 +32,9 @@ type BackupVaultsClient struct { } // NewBackupVaultsClient creates a new instance of BackupVaultsClient with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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) { if options == nil { options = &arm.ClientOptions{} @@ -57,12 +57,13 @@ func NewBackupVaultsClient(subscriptionID string, credential azcore.TokenCredent // CheckNameAvailability - API to check for resource name availability // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// location - The location in which uniqueness will be verified. -// parameters - Check name availability request -// options - BackupVaultsClientCheckNameAvailabilityOptions contains the optional parameters for the BackupVaultsClient.CheckNameAvailability -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - location - The location in which uniqueness will be verified. +// - parameters - Check name availability request +// - options - BackupVaultsClientCheckNameAvailabilityOptions contains the optional parameters for the BackupVaultsClient.CheckNameAvailability +// method. func (client *BackupVaultsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, location string, parameters CheckNameAvailabilityRequest, options *BackupVaultsClientCheckNameAvailabilityOptions) (BackupVaultsClientCheckNameAvailabilityResponse, error) { req, err := client.checkNameAvailabilityCreateRequest(ctx, resourceGroupName, location, parameters, options) if err != nil { @@ -85,9 +86,6 @@ func (client *BackupVaultsClient) checkNameAvailabilityCreateRequest(ctx context return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -98,7 +96,7 @@ func (client *BackupVaultsClient) checkNameAvailabilityCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -115,12 +113,13 @@ func (client *BackupVaultsClient) checkNameAvailabilityHandleResponse(resp *http // BeginCreateOrUpdate - Creates or updates a BackupVault resource belonging to a resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// parameters - Request body for operation -// options - BackupVaultsClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupVaultsClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - parameters - Request body for operation +// - options - BackupVaultsClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupVaultsClient.BeginCreateOrUpdate +// method. func (client *BackupVaultsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, parameters BackupVaultResource, options *BackupVaultsClientBeginCreateOrUpdateOptions) (*runtime.Poller[BackupVaultsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, vaultName, parameters, options) @@ -135,7 +134,8 @@ func (client *BackupVaultsClient) BeginCreateOrUpdate(ctx context.Context, resou // CreateOrUpdate - Creates or updates a BackupVault resource belonging to a resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview +// +// Generated from API version 2023-01-01 func (client *BackupVaultsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, parameters BackupVaultResource, options *BackupVaultsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vaultName, parameters, options) if err != nil { @@ -154,9 +154,6 @@ func (client *BackupVaultsClient) createOrUpdate(ctx context.Context, resourceGr // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *BackupVaultsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, parameters BackupVaultResource, options *BackupVaultsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" - 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") @@ -171,39 +168,54 @@ func (client *BackupVaultsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } +// BeginDelete - Deletes a BackupVault resource from the resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - 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, vaultName string, options *BackupVaultsClientBeginDeleteOptions) (*runtime.Poller[BackupVaultsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vaultName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[BackupVaultsClientDeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[BackupVaultsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + // Delete - Deletes a BackupVault resource from the resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - BackupVaultsClientDeleteOptions contains the optional parameters for the BackupVaultsClient.Delete method. -func (client *BackupVaultsClient) Delete(ctx context.Context, resourceGroupName string, vaultName string, options *BackupVaultsClientDeleteOptions) (BackupVaultsClientDeleteResponse, error) { +// +// Generated from API version 2023-01-01 +func (client *BackupVaultsClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, options *BackupVaultsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { - return BackupVaultsClientDeleteResponse{}, err + return nil, err } resp, err := client.pl.Do(req) if err != nil { - return BackupVaultsClientDeleteResponse{}, err + return nil, err } if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return BackupVaultsClientDeleteResponse{}, runtime.NewResponseError(resp) + return nil, runtime.NewResponseError(resp) } - return BackupVaultsClientDeleteResponse{}, nil + return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *BackupVaultsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *BackupVaultsClientDeleteOptions) (*policy.Request, error) { +func (client *BackupVaultsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *BackupVaultsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" - 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") @@ -218,7 +230,7 @@ func (client *BackupVaultsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -226,10 +238,11 @@ func (client *BackupVaultsClient) deleteCreateRequest(ctx context.Context, resou // Get - Returns a resource belonging to a resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - BackupVaultsClientGetOptions contains the optional parameters for the BackupVaultsClient.Get method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - 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, vaultName string, options *BackupVaultsClientGetOptions) (BackupVaultsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { @@ -248,9 +261,6 @@ func (client *BackupVaultsClient) Get(ctx context.Context, resourceGroupName str // getCreateRequest creates the Get request. func (client *BackupVaultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *BackupVaultsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" - 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") @@ -265,7 +275,7 @@ func (client *BackupVaultsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,10 +291,11 @@ func (client *BackupVaultsClient) getHandleResponse(resp *http.Response) (Backup } // NewGetInResourceGroupPager - Returns resource collection belonging to a resource group. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// options - BackupVaultsClientGetInResourceGroupOptions contains the optional parameters for the BackupVaultsClient.GetInResourceGroup -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - BackupVaultsClientGetInResourceGroupOptions contains the optional parameters for the BackupVaultsClient.NewGetInResourceGroupPager +// method. func (client *BackupVaultsClient) NewGetInResourceGroupPager(resourceGroupName string, options *BackupVaultsClientGetInResourceGroupOptions) *runtime.Pager[BackupVaultsClientGetInResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[BackupVaultsClientGetInResourceGroupResponse]{ More: func(page BackupVaultsClientGetInResourceGroupResponse) bool { @@ -320,16 +331,13 @@ func (client *BackupVaultsClient) getInResourceGroupCreateRequest(ctx context.Co return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -345,9 +353,10 @@ func (client *BackupVaultsClient) getInResourceGroupHandleResponse(resp *http.Re } // NewGetInSubscriptionPager - Returns resource collection belonging to a subscription. -// Generated from API version 2022-11-01-preview -// options - BackupVaultsClientGetInSubscriptionOptions contains the optional parameters for the BackupVaultsClient.GetInSubscription -// method. +// +// Generated from API version 2023-01-01 +// - options - BackupVaultsClientGetInSubscriptionOptions contains the optional parameters for the BackupVaultsClient.NewGetInSubscriptionPager +// method. func (client *BackupVaultsClient) NewGetInSubscriptionPager(options *BackupVaultsClientGetInSubscriptionOptions) *runtime.Pager[BackupVaultsClientGetInSubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[BackupVaultsClientGetInSubscriptionResponse]{ More: func(page BackupVaultsClientGetInSubscriptionResponse) bool { @@ -379,16 +388,13 @@ func (client *BackupVaultsClient) NewGetInSubscriptionPager(options *BackupVault // getInSubscriptionCreateRequest creates the GetInSubscription request. func (client *BackupVaultsClient) getInSubscriptionCreateRequest(ctx context.Context, options *BackupVaultsClientGetInSubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -405,12 +411,13 @@ func (client *BackupVaultsClient) getInSubscriptionHandleResponse(resp *http.Res // BeginUpdate - Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// parameters - Request body for operation -// options - BackupVaultsClientBeginUpdateOptions contains the optional parameters for the BackupVaultsClient.BeginUpdate -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - parameters - Request body for operation +// - options - BackupVaultsClientBeginUpdateOptions contains the optional parameters for the BackupVaultsClient.BeginUpdate +// method. func (client *BackupVaultsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vaultName string, parameters PatchResourceRequestInput, options *BackupVaultsClientBeginUpdateOptions) (*runtime.Poller[BackupVaultsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, vaultName, parameters, options) @@ -425,7 +432,8 @@ func (client *BackupVaultsClient) BeginUpdate(ctx context.Context, resourceGroup // Update - Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview +// +// Generated from API version 2023-01-01 func (client *BackupVaultsClient) update(ctx context.Context, resourceGroupName string, vaultName string, parameters PatchResourceRequestInput, options *BackupVaultsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vaultName, parameters, options) if err != nil { @@ -444,9 +452,6 @@ func (client *BackupVaultsClient) update(ctx context.Context, resourceGroupName // updateCreateRequest creates the Update request. func (client *BackupVaultsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, parameters PatchResourceRequestInput, options *BackupVaultsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" - 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") @@ -461,7 +466,7 @@ func (client *BackupVaultsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client_example_test.go deleted file mode 100644 index bc41c23e024f..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client_example_test.go +++ /dev/null @@ -1,263 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_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/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVaultsInSubscription.json -func ExampleBackupVaultsClient_NewGetInSubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupVaultsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetInSubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json -func ExampleBackupVaultsClient_NewGetInResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupVaultsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetInResourceGroupPager("SampleResourceGroup", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVault.json -func ExampleBackupVaultsClient_Get_getBackupVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupVaultsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "SampleResourceGroup", "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVaultWithMSI.json -func ExampleBackupVaultsClient_Get_getBackupVaultWithMsi() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupVaultsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "SampleResourceGroup", "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/PutBackupVault.json -func ExampleBackupVaultsClient_BeginCreateOrUpdate_createBackupVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupVaultsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "SampleResourceGroup", "swaggerExample", armdataprotection.BackupVaultResource{ - Identity: &armdataprotection.DppIdentityDetails{ - Type: to.Ptr("None"), - }, - Location: to.Ptr("WestUS"), - Tags: map[string]*string{ - "key1": to.Ptr("val1"), - }, - Properties: &armdataprotection.BackupVault{ - MonitoringSettings: &armdataprotection.MonitoringSettings{ - AzureMonitorAlertSettings: &armdataprotection.AzureMonitorAlertSettings{ - AlertsForAllJobFailures: to.Ptr(armdataprotection.AlertsStateEnabled), - }, - }, - StorageSettings: []*armdataprotection.StorageSetting{ - { - Type: to.Ptr(armdataprotection.StorageSettingTypesLocallyRedundant), - DatastoreType: to.Ptr(armdataprotection.StorageSettingStoreTypesVaultStore), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/PutBackupVaultWithMSI.json -func ExampleBackupVaultsClient_BeginCreateOrUpdate_createBackupVaultWithMsi() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupVaultsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "SampleResourceGroup", "swaggerExample", armdataprotection.BackupVaultResource{ - Identity: &armdataprotection.DppIdentityDetails{ - Type: to.Ptr("systemAssigned"), - }, - Location: to.Ptr("WestUS"), - Tags: map[string]*string{ - "key1": to.Ptr("val1"), - }, - Properties: &armdataprotection.BackupVault{ - MonitoringSettings: &armdataprotection.MonitoringSettings{ - AzureMonitorAlertSettings: &armdataprotection.AzureMonitorAlertSettings{ - AlertsForAllJobFailures: to.Ptr(armdataprotection.AlertsStateEnabled), - }, - }, - StorageSettings: []*armdataprotection.StorageSetting{ - { - Type: to.Ptr(armdataprotection.StorageSettingTypesLocallyRedundant), - DatastoreType: to.Ptr(armdataprotection.StorageSettingStoreTypesVaultStore), - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/DeleteBackupVault.json -func ExampleBackupVaultsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupVaultsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "SampleResourceGroup", "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/PatchBackupVault.json -func ExampleBackupVaultsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupVaultsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "SampleResourceGroup", "swaggerExample", armdataprotection.PatchResourceRequestInput{ - Properties: &armdataprotection.PatchBackupVaultInput{ - MonitoringSettings: &armdataprotection.MonitoringSettings{ - AzureMonitorAlertSettings: &armdataprotection.AzureMonitorAlertSettings{ - AlertsForAllJobFailures: to.Ptr(armdataprotection.AlertsStateEnabled), - }, - }, - }, - Tags: map[string]*string{ - "newKey": to.Ptr("newVal"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/CheckBackupVaultsNameAvailability.json -func ExampleBackupVaultsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewBackupVaultsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, "SampleResourceGroup", "westus", armdataprotection.CheckNameAvailabilityRequest{ - Name: to.Ptr("swaggerExample"), - Type: to.Ptr("Microsoft.DataProtection/BackupVaults"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/client.go b/sdk/resourcemanager/dataprotection/armdataprotection/client.go index 26c0b2714ff9..422524def953 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/client.go @@ -32,9 +32,9 @@ type Client struct { } // NewClient creates a new instance of Client with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,9 +57,10 @@ func NewClient(subscriptionID string, credential azcore.TokenCredential, options // CheckFeatureSupport - Validates if a feature is supported // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// parameters - Feature support request object -// options - ClientCheckFeatureSupportOptions contains the optional parameters for the Client.CheckFeatureSupport method. +// +// Generated from API version 2023-01-01 +// - parameters - Feature support request object +// - options - ClientCheckFeatureSupportOptions contains the optional parameters for the Client.CheckFeatureSupport method. func (client *Client) CheckFeatureSupport(ctx context.Context, location string, parameters FeatureValidationRequestBaseClassification, options *ClientCheckFeatureSupportOptions) (ClientCheckFeatureSupportResponse, error) { req, err := client.checkFeatureSupportCreateRequest(ctx, location, parameters, options) if err != nil { @@ -78,9 +79,6 @@ func (client *Client) CheckFeatureSupport(ctx context.Context, location string, // checkFeatureSupportCreateRequest creates the CheckFeatureSupport request. func (client *Client) checkFeatureSupportCreateRequest(ctx context.Context, location string, parameters FeatureValidationRequestBaseClassification, options *ClientCheckFeatureSupportOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport" - 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") @@ -91,7 +89,7 @@ func (client *Client) checkFeatureSupportCreateRequest(ctx context.Context, loca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/client_example_test.go deleted file mode 100644 index 94a7d5db3d42..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/client_example_test.go +++ /dev/null @@ -1,40 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_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/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/CheckfeatureSupport.json -func ExampleClient_CheckFeatureSupport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckFeatureSupport(ctx, "WestUS", &armdataprotection.FeatureValidationRequest{ - ObjectType: to.Ptr("FeatureValidationRequest"), - FeatureType: to.Ptr(armdataprotection.FeatureTypeDataSourceType), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/constants.go b/sdk/resourcemanager/dataprotection/armdataprotection/constants.go index 0cef969462a2..b50052f5e6a2 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/constants.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/constants.go @@ -11,7 +11,7 @@ package armdataprotection const ( moduleName = "armdataprotection" - moduleVersion = "v2.0.0-beta.1" + moduleVersion = "v2.0.0" ) type AbsoluteMarker string @@ -70,6 +70,24 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// CrossSubscriptionRestoreState - CrossSubscriptionRestore state +type CrossSubscriptionRestoreState string + +const ( + CrossSubscriptionRestoreStateDisabled CrossSubscriptionRestoreState = "Disabled" + CrossSubscriptionRestoreStateEnabled CrossSubscriptionRestoreState = "Enabled" + CrossSubscriptionRestoreStatePermanentlyDisabled CrossSubscriptionRestoreState = "PermanentlyDisabled" +) + +// PossibleCrossSubscriptionRestoreStateValues returns the possible values for the CrossSubscriptionRestoreState const type. +func PossibleCrossSubscriptionRestoreStateValues() []CrossSubscriptionRestoreState { + return []CrossSubscriptionRestoreState{ + CrossSubscriptionRestoreStateDisabled, + CrossSubscriptionRestoreStateEnabled, + CrossSubscriptionRestoreStatePermanentlyDisabled, + } +} + // CurrentProtectionState - Specifies the current protection state of the resource type CurrentProtectionState string @@ -259,8 +277,8 @@ func PossibleMonthValues() []Month { } } -// PersistentVolumeRestoreMode - Gets or sets the PV Restore Mode property. This property sets whether volumes needs to be -// restored. +// PersistentVolumeRestoreMode - Gets or sets the PV (Persistent Volume) Restore Mode property. This property sets whether +// volumes needs to be restored. type PersistentVolumeRestoreMode string const ( @@ -351,28 +369,6 @@ func PossibleRehydrationStatusValues() []RehydrationStatus { } } -// ResourceGuardProvisioningState - Provisioning state of the BackupVault resource -type ResourceGuardProvisioningState string - -const ( - ResourceGuardProvisioningStateFailed ResourceGuardProvisioningState = "Failed" - ResourceGuardProvisioningStateProvisioning ResourceGuardProvisioningState = "Provisioning" - ResourceGuardProvisioningStateSucceeded ResourceGuardProvisioningState = "Succeeded" - ResourceGuardProvisioningStateUnknown ResourceGuardProvisioningState = "Unknown" - ResourceGuardProvisioningStateUpdating ResourceGuardProvisioningState = "Updating" -) - -// PossibleResourceGuardProvisioningStateValues returns the possible values for the ResourceGuardProvisioningState const type. -func PossibleResourceGuardProvisioningStateValues() []ResourceGuardProvisioningState { - return []ResourceGuardProvisioningState{ - ResourceGuardProvisioningStateFailed, - ResourceGuardProvisioningStateProvisioning, - ResourceGuardProvisioningStateSucceeded, - ResourceGuardProvisioningStateUnknown, - ResourceGuardProvisioningStateUpdating, - } -} - // ResourceMoveState - Resource move state for backup vault type ResourceMoveState string @@ -482,15 +478,17 @@ func PossibleSoftDeleteStateValues() []SoftDeleteState { type SourceDataStoreType string const ( - SourceDataStoreTypeArchiveStore SourceDataStoreType = "ArchiveStore" - SourceDataStoreTypeSnapshotStore SourceDataStoreType = "SnapshotStore" - SourceDataStoreTypeVaultStore SourceDataStoreType = "VaultStore" + SourceDataStoreTypeArchiveStore SourceDataStoreType = "ArchiveStore" + SourceDataStoreTypeOperationalStore SourceDataStoreType = "OperationalStore" + SourceDataStoreTypeSnapshotStore SourceDataStoreType = "SnapshotStore" + SourceDataStoreTypeVaultStore SourceDataStoreType = "VaultStore" ) // PossibleSourceDataStoreTypeValues returns the possible values for the SourceDataStoreType const type. func PossibleSourceDataStoreTypeValues() []SourceDataStoreType { return []SourceDataStoreType{ SourceDataStoreTypeArchiveStore, + SourceDataStoreTypeOperationalStore, SourceDataStoreTypeSnapshotStore, SourceDataStoreTypeVaultStore, } @@ -524,16 +522,16 @@ func PossibleStatusValues() []Status { type StorageSettingStoreTypes string const ( - StorageSettingStoreTypesArchiveStore StorageSettingStoreTypes = "ArchiveStore" - StorageSettingStoreTypesSnapshotStore StorageSettingStoreTypes = "SnapshotStore" - StorageSettingStoreTypesVaultStore StorageSettingStoreTypes = "VaultStore" + StorageSettingStoreTypesArchiveStore StorageSettingStoreTypes = "ArchiveStore" + StorageSettingStoreTypesOperationalStore StorageSettingStoreTypes = "OperationalStore" + StorageSettingStoreTypesVaultStore StorageSettingStoreTypes = "VaultStore" ) // PossibleStorageSettingStoreTypesValues returns the possible values for the StorageSettingStoreTypes const type. func PossibleStorageSettingStoreTypesValues() []StorageSettingStoreTypes { return []StorageSettingStoreTypes{ StorageSettingStoreTypesArchiveStore, - StorageSettingStoreTypesSnapshotStore, + StorageSettingStoreTypesOperationalStore, StorageSettingStoreTypesVaultStore, } } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client.go index 4529ee90706b..4c8d9281fa91 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client.go @@ -32,9 +32,9 @@ type DeletedBackupInstancesClient struct { } // NewDeletedBackupInstancesClient creates a new instance of DeletedBackupInstancesClient with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewDeletedBackupInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeletedBackupInstancesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,12 +57,13 @@ func NewDeletedBackupInstancesClient(subscriptionID string, credential azcore.To // Get - Gets a deleted backup instance with name in a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// backupInstanceName - The name of the deleted backup instance -// options - DeletedBackupInstancesClientGetOptions contains the optional parameters for the DeletedBackupInstancesClient.Get -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the deleted backup instance +// - options - DeletedBackupInstancesClientGetOptions contains the optional parameters for the DeletedBackupInstancesClient.Get +// method. func (client *DeletedBackupInstancesClient) Get(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *DeletedBackupInstancesClientGetOptions) (DeletedBackupInstancesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { @@ -81,9 +82,6 @@ func (client *DeletedBackupInstancesClient) Get(ctx context.Context, resourceGro // getCreateRequest creates the Get request. func (client *DeletedBackupInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *DeletedBackupInstancesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}" - 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") @@ -102,7 +100,7 @@ func (client *DeletedBackupInstancesClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -118,11 +116,12 @@ func (client *DeletedBackupInstancesClient) getHandleResponse(resp *http.Respons } // NewListPager - Gets deleted backup instances belonging to a backup vault -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - DeletedBackupInstancesClientListOptions contains the optional parameters for the DeletedBackupInstancesClient.List -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - options - DeletedBackupInstancesClientListOptions contains the optional parameters for the DeletedBackupInstancesClient.NewListPager +// method. func (client *DeletedBackupInstancesClient) NewListPager(resourceGroupName string, vaultName string, options *DeletedBackupInstancesClientListOptions) *runtime.Pager[DeletedBackupInstancesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[DeletedBackupInstancesClientListResponse]{ More: func(page DeletedBackupInstancesClientListResponse) bool { @@ -154,9 +153,6 @@ func (client *DeletedBackupInstancesClient) NewListPager(resourceGroupName strin // listCreateRequest creates the List request. func (client *DeletedBackupInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *DeletedBackupInstancesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances" - 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") @@ -171,7 +167,7 @@ func (client *DeletedBackupInstancesClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,12 +184,13 @@ func (client *DeletedBackupInstancesClient) listHandleResponse(resp *http.Respon // BeginUndelete - // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// backupInstanceName - The name of the deleted backup instance -// options - DeletedBackupInstancesClientBeginUndeleteOptions contains the optional parameters for the DeletedBackupInstancesClient.BeginUndelete -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the deleted backup instance +// - options - DeletedBackupInstancesClientBeginUndeleteOptions contains the optional parameters for the DeletedBackupInstancesClient.BeginUndelete +// method. func (client *DeletedBackupInstancesClient) BeginUndelete(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *DeletedBackupInstancesClientBeginUndeleteOptions) (*runtime.Poller[DeletedBackupInstancesClientUndeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.undelete(ctx, resourceGroupName, vaultName, backupInstanceName, options) @@ -208,7 +205,8 @@ func (client *DeletedBackupInstancesClient) BeginUndelete(ctx context.Context, r // Undelete - // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview +// +// Generated from API version 2023-01-01 func (client *DeletedBackupInstancesClient) undelete(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *DeletedBackupInstancesClientBeginUndeleteOptions) (*http.Response, error) { req, err := client.undeleteCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { @@ -227,9 +225,6 @@ func (client *DeletedBackupInstancesClient) undelete(ctx context.Context, resour // undeleteCreateRequest creates the Undelete request. func (client *DeletedBackupInstancesClient) undeleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *DeletedBackupInstancesClientBeginUndeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}/undelete" - 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") @@ -248,7 +243,7 @@ func (client *DeletedBackupInstancesClient) undeleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client_example_test.go deleted file mode 100644 index 723e10483fa7..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client_example_test.go +++ /dev/null @@ -1,81 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json -func ExampleDeletedBackupInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewDeletedBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("000pikumar", "PratikPrivatePreviewVault1", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json -func ExampleDeletedBackupInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewDeletedBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "000pikumar", "PratikPrivatePreviewVault1", "testInstance1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json -func ExampleDeletedBackupInstancesClient_BeginUndelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewDeletedBackupInstancesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUndelete(ctx, "testrg", "testvault", "testbi", 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/dataprotection/armdataprotection/dppresourceguardproxy_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/dppresourceguardproxy_client.go deleted file mode 100644 index a5c359ae0b38..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/dppresourceguardproxy_client.go +++ /dev/null @@ -1,360 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "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" -) - -// DppResourceGuardProxyClient contains the methods for the DppResourceGuardProxy group. -// Don't use this type directly, use NewDppResourceGuardProxyClient() instead. -type DppResourceGuardProxyClient struct { - host string - subscriptionID string - pl runtime.Pipeline -} - -// NewDppResourceGuardProxyClient creates a new instance of DppResourceGuardProxyClient with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewDppResourceGuardProxyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DppResourceGuardProxyClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &DppResourceGuardProxyClient{ - subscriptionID: subscriptionID, - host: ep, - pl: pl, - } - return client, nil -} - -// Delete - -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - DppResourceGuardProxyClientDeleteOptions contains the optional parameters for the DppResourceGuardProxyClient.Delete -// method. -func (client *DppResourceGuardProxyClient) Delete(ctx context.Context, resourceGroupName string, vaultName string, resourceGuardProxyName string, options *DppResourceGuardProxyClientDeleteOptions) (DppResourceGuardProxyClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, resourceGuardProxyName, options) - if err != nil { - return DppResourceGuardProxyClientDeleteResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return DppResourceGuardProxyClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return DppResourceGuardProxyClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return DppResourceGuardProxyClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *DppResourceGuardProxyClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, resourceGuardProxyName string, options *DppResourceGuardProxyClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" - 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 vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - if resourceGuardProxyName == "" { - return nil, errors.New("parameter resourceGuardProxyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGuardProxyName}", url.PathEscape(resourceGuardProxyName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - DppResourceGuardProxyClientGetOptions contains the optional parameters for the DppResourceGuardProxyClient.Get -// method. -func (client *DppResourceGuardProxyClient) Get(ctx context.Context, resourceGroupName string, vaultName string, resourceGuardProxyName string, options *DppResourceGuardProxyClientGetOptions) (DppResourceGuardProxyClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, resourceGuardProxyName, options) - if err != nil { - return DppResourceGuardProxyClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return DppResourceGuardProxyClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DppResourceGuardProxyClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *DppResourceGuardProxyClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, resourceGuardProxyName string, options *DppResourceGuardProxyClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" - 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 vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - if resourceGuardProxyName == "" { - return nil, errors.New("parameter resourceGuardProxyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGuardProxyName}", url.PathEscape(resourceGuardProxyName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-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 *DppResourceGuardProxyClient) getHandleResponse(resp *http.Response) (DppResourceGuardProxyClientGetResponse, error) { - result := DppResourceGuardProxyClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGuardProxyBaseResource); err != nil { - return DppResourceGuardProxyClientGetResponse{}, err - } - return result, nil -} - -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - DppResourceGuardProxyClientListOptions contains the optional parameters for the DppResourceGuardProxyClient.List -// method. -func (client *DppResourceGuardProxyClient) NewListPager(resourceGroupName string, vaultName string, options *DppResourceGuardProxyClientListOptions) *runtime.Pager[DppResourceGuardProxyClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[DppResourceGuardProxyClientListResponse]{ - More: func(page DppResourceGuardProxyClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DppResourceGuardProxyClientListResponse) (DppResourceGuardProxyClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, resourceGroupName, vaultName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return DppResourceGuardProxyClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return DppResourceGuardProxyClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DppResourceGuardProxyClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - }) -} - -// listCreateRequest creates the List request. -func (client *DppResourceGuardProxyClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *DppResourceGuardProxyClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies" - 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 vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-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 *DppResourceGuardProxyClient) listHandleResponse(resp *http.Response) (DppResourceGuardProxyClientListResponse, error) { - result := DppResourceGuardProxyClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGuardProxyBaseResourceList); err != nil { - return DppResourceGuardProxyClientListResponse{}, err - } - return result, nil -} - -// Put - -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// parameters - Request body for operation -// options - DppResourceGuardProxyClientPutOptions contains the optional parameters for the DppResourceGuardProxyClient.Put -// method. -func (client *DppResourceGuardProxyClient) Put(ctx context.Context, resourceGroupName string, vaultName string, resourceGuardProxyName string, parameters ResourceGuardProxyBaseResource, options *DppResourceGuardProxyClientPutOptions) (DppResourceGuardProxyClientPutResponse, error) { - req, err := client.putCreateRequest(ctx, resourceGroupName, vaultName, resourceGuardProxyName, parameters, options) - if err != nil { - return DppResourceGuardProxyClientPutResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return DppResourceGuardProxyClientPutResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DppResourceGuardProxyClientPutResponse{}, runtime.NewResponseError(resp) - } - return client.putHandleResponse(resp) -} - -// putCreateRequest creates the Put request. -func (client *DppResourceGuardProxyClient) putCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, resourceGuardProxyName string, parameters ResourceGuardProxyBaseResource, options *DppResourceGuardProxyClientPutOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" - 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 vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - if resourceGuardProxyName == "" { - return nil, errors.New("parameter resourceGuardProxyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGuardProxyName}", url.PathEscape(resourceGuardProxyName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// putHandleResponse handles the Put response. -func (client *DppResourceGuardProxyClient) putHandleResponse(resp *http.Response) (DppResourceGuardProxyClientPutResponse, error) { - result := DppResourceGuardProxyClientPutResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGuardProxyBaseResource); err != nil { - return DppResourceGuardProxyClientPutResponse{}, err - } - return result, nil -} - -// UnlockDelete - -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// parameters - Request body for operation -// options - DppResourceGuardProxyClientUnlockDeleteOptions contains the optional parameters for the DppResourceGuardProxyClient.UnlockDelete -// method. -func (client *DppResourceGuardProxyClient) UnlockDelete(ctx context.Context, resourceGroupName string, vaultName string, resourceGuardProxyName string, parameters UnlockDeleteRequest, options *DppResourceGuardProxyClientUnlockDeleteOptions) (DppResourceGuardProxyClientUnlockDeleteResponse, error) { - req, err := client.unlockDeleteCreateRequest(ctx, resourceGroupName, vaultName, resourceGuardProxyName, parameters, options) - if err != nil { - return DppResourceGuardProxyClientUnlockDeleteResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return DppResourceGuardProxyClientUnlockDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DppResourceGuardProxyClientUnlockDeleteResponse{}, runtime.NewResponseError(resp) - } - return client.unlockDeleteHandleResponse(resp) -} - -// unlockDeleteCreateRequest creates the UnlockDelete request. -func (client *DppResourceGuardProxyClient) unlockDeleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, resourceGuardProxyName string, parameters UnlockDeleteRequest, options *DppResourceGuardProxyClientUnlockDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete" - 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 vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - if resourceGuardProxyName == "" { - return nil, errors.New("parameter resourceGuardProxyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGuardProxyName}", url.PathEscape(resourceGuardProxyName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// unlockDeleteHandleResponse handles the UnlockDelete response. -func (client *DppResourceGuardProxyClient) unlockDeleteHandleResponse(resp *http.Response) (DppResourceGuardProxyClientUnlockDeleteResponse, error) { - result := DppResourceGuardProxyClientUnlockDeleteResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.UnlockDeleteResponse); err != nil { - return DppResourceGuardProxyClientUnlockDeleteResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/dppresourceguardproxy_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/dppresourceguardproxy_client_example_test.go deleted file mode 100644 index 1c37a6088976..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/dppresourceguardproxy_client_example_test.go +++ /dev/null @@ -1,124 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_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/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json -func ExampleDppResourceGuardProxyClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewDppResourceGuardProxyClient("5e13b949-1218-4d18-8b99-7e12155ec4f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("SampleResourceGroup", "sampleVault", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json -func ExampleDppResourceGuardProxyClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewDppResourceGuardProxyClient("5e13b949-1218-4d18-8b99-7e12155ec4f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "SampleResourceGroup", "sampleVault", "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json -func ExampleDppResourceGuardProxyClient_Put() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewDppResourceGuardProxyClient("5e13b949-1218-4d18-8b99-7e12155ec4f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Put(ctx, "SampleResourceGroup", "sampleVault", "swaggerExample", armdataprotection.ResourceGuardProxyBaseResource{ - Properties: &armdataprotection.ResourceGuardProxyBase{ - ResourceGuardResourceID: to.Ptr("/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json -func ExampleDppResourceGuardProxyClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewDppResourceGuardProxyClient("5e13b949-1218-4d18-8b99-7e12155ec4f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "SampleResourceGroup", "sampleVault", "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json -func ExampleDppResourceGuardProxyClient_UnlockDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewDppResourceGuardProxyClient("5e13b949-1218-4d18-8b99-7e12155ec4f7", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.UnlockDelete(ctx, "SampleResourceGroup", "sampleVault", "swaggerExample", armdataprotection.UnlockDeleteRequest{ - ResourceGuardOperationRequests: []*string{ - to.Ptr("/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource/deleteBackupInstanceRequests/default")}, - ResourceToBeDeleted: to.Ptr("/subscriptions/5e13b949-1218-4d18-8b99-7e12155ec4f7/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/backupVaults/sampleVault/backupInstances/TestBI9779f4de"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client.go index 6d60e1aaad37..efaee43b9797 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client.go @@ -32,9 +32,9 @@ type ExportJobsClient struct { } // NewExportJobsClient creates a new instance of ExportJobsClient with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewExportJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExportJobsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,10 +57,11 @@ func NewExportJobsClient(subscriptionID string, credential azcore.TokenCredentia // BeginTrigger - Triggers export of jobs and returns an OperationID to track. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - ExportJobsClientBeginTriggerOptions contains the optional parameters for the ExportJobsClient.BeginTrigger method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - options - ExportJobsClientBeginTriggerOptions contains the optional parameters for the ExportJobsClient.BeginTrigger method. func (client *ExportJobsClient) BeginTrigger(ctx context.Context, resourceGroupName string, vaultName string, options *ExportJobsClientBeginTriggerOptions) (*runtime.Poller[ExportJobsClientTriggerResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.trigger(ctx, resourceGroupName, vaultName, options) @@ -77,7 +78,8 @@ func (client *ExportJobsClient) BeginTrigger(ctx context.Context, resourceGroupN // Trigger - Triggers export of jobs and returns an OperationID to track. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview +// +// Generated from API version 2023-01-01 func (client *ExportJobsClient) trigger(ctx context.Context, resourceGroupName string, vaultName string, options *ExportJobsClientBeginTriggerOptions) (*http.Response, error) { req, err := client.triggerCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { @@ -96,9 +98,6 @@ func (client *ExportJobsClient) trigger(ctx context.Context, resourceGroupName s // triggerCreateRequest creates the Trigger request. func (client *ExportJobsClient) triggerCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *ExportJobsClientBeginTriggerOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs" - 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") @@ -113,7 +112,7 @@ func (client *ExportJobsClient) triggerCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client_example_test.go deleted file mode 100644 index ba380f65d753..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client_example_test.go +++ /dev/null @@ -1,38 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/TriggerExportJobs.json -func ExampleExportJobsClient_BeginTrigger() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewExportJobsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginTrigger(ctx, "SwaggerTestRg", "NetSDKTestRsVault", 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/dataprotection/armdataprotection/exportjobsoperationresult_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client.go index fca360652dae..e2ca5b59e22f 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client.go @@ -32,9 +32,9 @@ type ExportJobsOperationResultClient struct { } // NewExportJobsOperationResultClient creates a new instance of ExportJobsOperationResultClient with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewExportJobsOperationResultClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExportJobsOperationResultClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -59,12 +59,13 @@ func NewExportJobsOperationResultClient(subscriptionID string, credential azcore // contains URL of a Blob and a SAS key to access the same. The blob contains exported // jobs in JSON serialized format. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// operationID - OperationID which represents the export job. -// options - ExportJobsOperationResultClientGetOptions contains the optional parameters for the ExportJobsOperationResultClient.Get -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - operationID - OperationID which represents the export job. +// - options - ExportJobsOperationResultClientGetOptions contains the optional parameters for the ExportJobsOperationResultClient.Get +// method. func (client *ExportJobsOperationResultClient) Get(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *ExportJobsOperationResultClientGetOptions) (ExportJobsOperationResultClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, operationID, options) if err != nil { @@ -83,9 +84,6 @@ func (client *ExportJobsOperationResultClient) Get(ctx context.Context, resource // getCreateRequest creates the Get request. func (client *ExportJobsOperationResultClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *ExportJobsOperationResultClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/operations/{operationId}" - 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") @@ -104,7 +102,7 @@ func (client *ExportJobsOperationResultClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client_example_test.go deleted file mode 100644 index 8e612e67cf23..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client_example_test.go +++ /dev/null @@ -1,36 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/GetExportJobsOperationResult.json -func ExampleExportJobsOperationResultClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewExportJobsOperationResultClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "SwaggerTestRg", "NetSDKTestRsVault", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/go.mod b/sdk/resourcemanager/dataprotection/armdataprotection/go.mod index 076a3c9ba2ac..9353aa998d30 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/go.mod +++ b/sdk/resourcemanager/dataprotection/armdataprotection/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armd go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 // indirect - github.com/golang-jwt/jwt/v4 v4.4.2 // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/go.sum b/sdk/resourcemanager/dataprotection/armdataprotection/go.sum index 8c0539b73123..3afb578030a5 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/go.sum +++ b/sdk/resourcemanager/dataprotection/armdataprotection/go.sum @@ -1,30 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 h1:t/W5MYAuQy81cvM8VUNfRLzhtKpXhVUAN7Cd7KVbTyc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0/go.mod h1:NBanQUfSWiWn3QEpWDTCU0IjBECKOYvl2R8xdRtMtiM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 h1:VgSJlZH5u0k2qxSpqyghcFQKmvYckj46uymKK5XzkBM= -github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0/go.mod h1:BDJ5qMFKx9DugEg3+uQSDCdbYPr5s9vBTrL9P8TpqOU= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= -github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/jobs_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/jobs_client.go index eaa3d890fddd..59990c50b880 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/jobs_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/jobs_client.go @@ -32,9 +32,9 @@ type JobsClient struct { } // NewJobsClient creates a new instance of JobsClient with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,11 +57,12 @@ func NewJobsClient(subscriptionID string, credential azcore.TokenCredential, opt // Get - Gets a job with id in a backup vault // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// jobID - The Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). -// options - JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - jobID - The Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). +// - options - JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. func (client *JobsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, jobID string, options *JobsClientGetOptions) (JobsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, jobID, options) if err != nil { @@ -80,9 +81,6 @@ func (client *JobsClient) Get(ctx context.Context, resourceGroupName string, vau // getCreateRequest creates the Get request. func (client *JobsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, jobID string, options *JobsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}" - 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") @@ -101,7 +99,7 @@ func (client *JobsClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,10 +115,11 @@ func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsClientGetR } // NewListPager - Returns list of jobs belonging to a backup vault -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - JobsClientListOptions contains the optional parameters for the JobsClient.List method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - options - JobsClientListOptions contains the optional parameters for the JobsClient.NewListPager method. func (client *JobsClient) NewListPager(resourceGroupName string, vaultName string, options *JobsClientListOptions) *runtime.Pager[JobsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[JobsClientListResponse]{ More: func(page JobsClientListResponse) bool { @@ -152,9 +151,6 @@ func (client *JobsClient) NewListPager(resourceGroupName string, vaultName strin // listCreateRequest creates the List request. func (client *JobsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *JobsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs" - 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") @@ -169,7 +165,7 @@ func (client *JobsClient) listCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/jobs_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/jobs_client_example_test.go deleted file mode 100644 index 0a0ebbb49af2..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/jobs_client_example_test.go +++ /dev/null @@ -1,60 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/ListJobs.json -func ExampleJobsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewJobsClient("62b829ee-7936-40c9-a1c9-47a93f9f3965", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("BugBash1", "BugBashVaultForCCYv11", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/GetJob.json -func ExampleJobsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewJobsClient("62b829ee-7936-40c9-a1c9-47a93f9f3965", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "BugBash1", "BugBashVaultForCCYv11", "3c60cb49-63e8-4b21-b9bd-26277b3fdfae", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/models.go b/sdk/resourcemanager/dataprotection/armdataprotection/models.go index 3bbf0974f8c3..a22e69738043 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/models.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/models.go @@ -97,6 +97,9 @@ type AzureBackupDiscreteRecoveryPoint struct { RecoveryPointType *string `json:"recoveryPointType,omitempty"` RetentionTagName *string `json:"retentionTagName,omitempty"` RetentionTagVersion *string `json:"retentionTagVersion,omitempty"` + + // READ-ONLY + ExpiryTime *time.Time `json:"expiryTime,omitempty" azure:"ro"` } // GetAzureBackupRecoveryPoint implements the AzureBackupRecoveryPointClassification interface for type AzureBackupDiscreteRecoveryPoint. @@ -766,17 +769,11 @@ type BackupInstancesClientGetOptions struct { // placeholder for future optional parameters } -// BackupInstancesClientListOptions contains the optional parameters for the BackupInstancesClient.List method. +// BackupInstancesClientListOptions contains the optional parameters for the BackupInstancesClient.NewListPager method. type BackupInstancesClientListOptions struct { // placeholder for future optional parameters } -// BackupInstancesExtensionRoutingClientListOptions contains the optional parameters for the BackupInstancesExtensionRoutingClient.List -// method. -type BackupInstancesExtensionRoutingClientListOptions struct { - // placeholder for future optional parameters -} - // BackupParametersClassification provides polymorphic access to related types. // Call the interface's GetBackupParameters() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -811,7 +808,7 @@ type BackupPoliciesClientGetOptions struct { // placeholder for future optional parameters } -// BackupPoliciesClientListOptions contains the optional parameters for the BackupPoliciesClient.List method. +// BackupPoliciesClientListOptions contains the optional parameters for the BackupPoliciesClient.NewListPager method. type BackupPoliciesClientListOptions struct { // placeholder for future optional parameters } @@ -850,6 +847,9 @@ type BackupVault struct { // REQUIRED; Storage Settings StorageSettings []*StorageSetting `json:"storageSettings,omitempty"` + // Feature Settings + FeatureSettings *FeatureSettings `json:"featureSettings,omitempty"` + // Monitoring Settings MonitoringSettings *MonitoringSettings `json:"monitoringSettings,omitempty"` @@ -921,6 +921,12 @@ type BackupVaultsClientBeginCreateOrUpdateOptions struct { 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. @@ -933,18 +939,13 @@ type BackupVaultsClientCheckNameAvailabilityOptions struct { // placeholder for future optional parameters } -// BackupVaultsClientDeleteOptions contains the optional parameters for the BackupVaultsClient.Delete method. -type BackupVaultsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// BackupVaultsClientGetInResourceGroupOptions contains the optional parameters for the BackupVaultsClient.GetInResourceGroup +// BackupVaultsClientGetInResourceGroupOptions contains the optional parameters for the BackupVaultsClient.NewGetInResourceGroupPager // method. type BackupVaultsClientGetInResourceGroupOptions struct { // placeholder for future optional parameters } -// BackupVaultsClientGetInSubscriptionOptions contains the optional parameters for the BackupVaultsClient.GetInSubscription +// BackupVaultsClientGetInSubscriptionOptions contains the optional parameters for the BackupVaultsClient.NewGetInSubscriptionPager // method. type BackupVaultsClientGetInSubscriptionOptions struct { // placeholder for future optional parameters @@ -1163,6 +1164,12 @@ type CopyOption struct { // GetCopyOption implements the CopyOptionClassification interface for type CopyOption. func (c *CopyOption) GetCopyOption() *CopyOption { return c } +// CrossSubscriptionRestoreSettings - CrossSubscriptionRestore Settings +type CrossSubscriptionRestoreSettings struct { + // CrossSubscriptionRestore state + State *CrossSubscriptionRestoreState `json:"state,omitempty"` +} + // CustomCopyOption - Duration based custom options to copy type CustomCopyOption struct { // REQUIRED; Type of the specific object - used for deserializing @@ -1367,7 +1374,8 @@ type DeletedBackupInstancesClientGetOptions struct { // placeholder for future optional parameters } -// DeletedBackupInstancesClientListOptions contains the optional parameters for the DeletedBackupInstancesClient.List method. +// DeletedBackupInstancesClientListOptions contains the optional parameters for the DeletedBackupInstancesClient.NewListPager +// method. type DeletedBackupInstancesClientListOptions struct { // placeholder for future optional parameters } @@ -1408,6 +1416,29 @@ type DppBaseResourceList struct { Value []*DppBaseResource `json:"value,omitempty"` } +type DppBaseTrackedResource struct { + // Optional ETag. + ETag *string `json:"eTag,omitempty"` + + // Resource location. + Location *string `json:"location,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Resource Id represents the complete path to the resource. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name associated with the resource. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… + Type *string `json:"type,omitempty" azure:"ro"` +} + // DppIdentityDetails - Identity details type DppIdentityDetails struct { // The identityType which can be either SystemAssigned or None @@ -1453,32 +1484,6 @@ type DppResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// DppResourceGuardProxyClientDeleteOptions contains the optional parameters for the DppResourceGuardProxyClient.Delete method. -type DppResourceGuardProxyClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// DppResourceGuardProxyClientGetOptions contains the optional parameters for the DppResourceGuardProxyClient.Get method. -type DppResourceGuardProxyClientGetOptions struct { - // placeholder for future optional parameters -} - -// DppResourceGuardProxyClientListOptions contains the optional parameters for the DppResourceGuardProxyClient.List method. -type DppResourceGuardProxyClientListOptions struct { - // placeholder for future optional parameters -} - -// DppResourceGuardProxyClientPutOptions contains the optional parameters for the DppResourceGuardProxyClient.Put method. -type DppResourceGuardProxyClientPutOptions struct { - // placeholder for future optional parameters -} - -// DppResourceGuardProxyClientUnlockDeleteOptions contains the optional parameters for the DppResourceGuardProxyClient.UnlockDelete -// method. -type DppResourceGuardProxyClientUnlockDeleteOptions struct { - // placeholder for future optional parameters -} - // DppResourceList - ListResource type DppResourceList struct { // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. @@ -1551,7 +1556,7 @@ type Error struct { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty" azure:"ro"` + Info any `json:"info,omitempty" azure:"ro"` // READ-ONLY; The additional info type. Type *string `json:"type,omitempty" azure:"ro"` @@ -1584,6 +1589,12 @@ type ExportJobsResult struct { ExcelFileBlobURL *string `json:"excelFileBlobUrl,omitempty" azure:"ro"` } +// FeatureSettings - Class containing feature settings of vault +type FeatureSettings struct { + // CrossSubscriptionRestore Settings + CrossSubscriptionRestoreSettings *CrossSubscriptionRestoreSettings `json:"crossSubscriptionRestoreSettings,omitempty"` +} + // FeatureValidationRequest - Base class for feature object type FeatureValidationRequest struct { // REQUIRED; Type of the specific object - used for deserializing @@ -1815,7 +1826,7 @@ type JobsClientGetOptions struct { // placeholder for future optional parameters } -// JobsClientListOptions contains the optional parameters for the JobsClient.List method. +// JobsClientListOptions contains the optional parameters for the JobsClient.NewListPager method. type JobsClientListOptions struct { // placeholder for future optional parameters } @@ -1887,7 +1898,7 @@ type KubernetesClusterRestoreCriteria struct { // Gets or sets the Namespace Mappings property. This property sets if namespace needs to be change during restore. NamespaceMappings map[string]*string `json:"namespaceMappings,omitempty"` - // Gets or sets the PV Restore Mode property. This property sets whether volumes needs to be restored. + // Gets or sets the PV (Persistent Volume) Restore Mode property. This property sets whether volumes needs to be restored. PersistentVolumeRestoreMode *PersistentVolumeRestoreMode `json:"persistentVolumeRestoreMode,omitempty"` } @@ -2022,13 +2033,16 @@ type OperationStatusResourceGroupContextClientGetOptions struct { // placeholder for future optional parameters } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } // PatchBackupVaultInput - Backup Vault Contract for Patch Backup Vault API. type PatchBackupVaultInput struct { + // Feature Settings + FeatureSettings *FeatureSettings `json:"featureSettings,omitempty"` + // Monitoring Settings MonitoringSettings *MonitoringSettings `json:"monitoringSettings,omitempty"` @@ -2036,6 +2050,12 @@ type PatchBackupVaultInput struct { SecuritySettings *SecuritySettings `json:"securitySettings,omitempty"` } +// PatchResourceGuardInput - Patch Request content for Microsoft.DataProtection Resource Guard resources +type PatchResourceGuardInput struct { + // Resource Guard tags. + Tags map[string]*string `json:"tags,omitempty"` +} + // PatchResourceRequestInput - Patch Request content for Microsoft.DataProtection resources type PatchResourceRequestInput struct { // Input Managed Identity Details @@ -2119,7 +2139,7 @@ type RecoveryPointsClientGetOptions struct { // placeholder for future optional parameters } -// RecoveryPointsClientListOptions contains the optional parameters for the RecoveryPointsClient.List method. +// RecoveryPointsClientListOptions contains the optional parameters for the RecoveryPointsClient.NewListPager method. type RecoveryPointsClientListOptions struct { // OData filter options. Filter *string @@ -2147,7 +2167,7 @@ type ResourceGuard struct { Description *string `json:"description,omitempty" azure:"ro"` // READ-ONLY; Provisioning state of the BackupVault resource - ProvisioningState *ResourceGuardProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` // READ-ONLY; {readonly} List of operation details those are protected by the ResourceGuard resource ResourceGuardOperations []*ResourceGuardOperation `json:"resourceGuardOperations,omitempty" azure:"ro"` @@ -2162,51 +2182,10 @@ type ResourceGuardOperation struct { VaultCriticalOperation *string `json:"vaultCriticalOperation,omitempty" azure:"ro"` } -type ResourceGuardOperationDetail struct { - DefaultResourceRequest *string `json:"defaultResourceRequest,omitempty"` - VaultCriticalOperation *string `json:"vaultCriticalOperation,omitempty"` -} - -type ResourceGuardProxyBase struct { - Description *string `json:"description,omitempty"` - LastUpdatedTime *string `json:"lastUpdatedTime,omitempty"` - ResourceGuardOperationDetails []*ResourceGuardOperationDetail `json:"resourceGuardOperationDetails,omitempty"` - ResourceGuardResourceID *string `json:"resourceGuardResourceId,omitempty"` -} - -type ResourceGuardProxyBaseResource struct { - // ResourceGuardProxyBaseResource properties - Properties *ResourceGuardProxyBase `json:"properties,omitempty"` - - // READ-ONLY; Resource Id represents the complete path to the resource. - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; Resource name associated with the resource. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` - - // READ-ONLY; Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ResourceGuardProxyBaseResourceList - List of ResourceGuardProxyBase resources -type ResourceGuardProxyBaseResourceList struct { - // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. - NextLink *string `json:"nextLink,omitempty"` - - // List of resources. - Value []*ResourceGuardProxyBaseResource `json:"value,omitempty"` -} - type ResourceGuardResource struct { // Optional ETag. ETag *string `json:"eTag,omitempty"` - // Input Managed Identity Details - Identity *DppIdentityDetails `json:"identity,omitempty"` - // Resource location. Location *string `json:"location,omitempty"` @@ -2243,7 +2222,7 @@ type ResourceGuardsClientDeleteOptions struct { // placeholder for future optional parameters } -// ResourceGuardsClientGetBackupSecurityPINRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetBackupSecurityPINRequestsObjects +// ResourceGuardsClientGetBackupSecurityPINRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetBackupSecurityPINRequestsObjectsPager // method. type ResourceGuardsClientGetBackupSecurityPINRequestsObjectsOptions struct { // placeholder for future optional parameters @@ -2285,19 +2264,19 @@ type ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectOptions s // placeholder for future optional parameters } -// ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetDeleteProtectedItemRequestsObjects +// ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetDeleteProtectedItemRequestsObjectsPager // method. type ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsOptions struct { // placeholder for future optional parameters } -// ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetDeleteResourceGuardProxyRequestsObjects +// ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetDeleteResourceGuardProxyRequestsObjectsPager // method. type ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsOptions struct { // placeholder for future optional parameters } -// ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetDisableSoftDeleteRequestsObjects +// ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetDisableSoftDeleteRequestsObjectsPager // method. type ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsOptions struct { // placeholder for future optional parameters @@ -2308,25 +2287,25 @@ type ResourceGuardsClientGetOptions struct { // placeholder for future optional parameters } -// ResourceGuardsClientGetResourcesInResourceGroupOptions contains the optional parameters for the ResourceGuardsClient.GetResourcesInResourceGroup +// ResourceGuardsClientGetResourcesInResourceGroupOptions contains the optional parameters for the ResourceGuardsClient.NewGetResourcesInResourceGroupPager // method. type ResourceGuardsClientGetResourcesInResourceGroupOptions struct { // placeholder for future optional parameters } -// ResourceGuardsClientGetResourcesInSubscriptionOptions contains the optional parameters for the ResourceGuardsClient.GetResourcesInSubscription +// ResourceGuardsClientGetResourcesInSubscriptionOptions contains the optional parameters for the ResourceGuardsClient.NewGetResourcesInSubscriptionPager // method. type ResourceGuardsClientGetResourcesInSubscriptionOptions struct { // placeholder for future optional parameters } -// ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetUpdateProtectedItemRequestsObjects +// ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetUpdateProtectedItemRequestsObjectsPager // method. type ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsOptions struct { // placeholder for future optional parameters } -// ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetUpdateProtectionPolicyRequestsObjects +// ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetUpdateProtectionPolicyRequestsObjectsPager // method. type ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsOptions struct { // placeholder for future optional parameters @@ -2614,7 +2593,7 @@ type SystemData struct { // The type of identity that created the resource. CreatedByType *CreatedByType `json:"createdByType,omitempty"` - // The type of identity that last modified the resource. + // The timestamp of resource last modification (UTC) LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` // The identity that last modified the resource. @@ -2659,6 +2638,11 @@ type TargetDetails struct { // REQUIRED; Url denoting the restore destination. It can point to container / file share etc URL *string `json:"url,omitempty"` + + // Full ARM Id denoting the restore destination. It is the ARM Id pointing to container / file share This is optional if the + // target subscription can be identified with the URL field. If not then this is + // needed if CrossSubscriptionRestore field of BackupVault is in any of the disabled states + TargetResourceArmID *string `json:"targetResourceArmId,omitempty"` } // TriggerBackupRequest - Trigger backup request @@ -2685,18 +2669,6 @@ type TriggerContext struct { // GetTriggerContext implements the TriggerContextClassification interface for type TriggerContext. func (t *TriggerContext) GetTriggerContext() *TriggerContext { return t } -// UnlockDeleteRequest - Request body of unlock delete API. -type UnlockDeleteRequest struct { - ResourceGuardOperationRequests []*string `json:"resourceGuardOperationRequests,omitempty"` - ResourceToBeDeleted *string `json:"resourceToBeDeleted,omitempty"` -} - -// UnlockDeleteResponse - Response of Unlock Delete API. -type UnlockDeleteResponse struct { - // This is the time when unlock delete privileges will get expired. - UnlockDeleteExpiryTime *string `json:"unlockDeleteExpiryTime,omitempty"` -} - // UserFacingError - Error object used by layers that have access to localized content, and propagate that to user type UserFacingError struct { // Unique code for this error diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/models_serde.go b/sdk/resourcemanager/dataprotection/armdataprotection/models_serde.go index 70bd127dd835..43fa361ff674 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/models_serde.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/models_serde.go @@ -19,7 +19,7 @@ import ( // MarshalJSON implements the json.Marshaller interface for type AbsoluteDeleteOption. func (a AbsoluteDeleteOption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "duration", a.Duration) objectMap["objectType"] = "AbsoluteDeleteOption" return json.Marshal(objectMap) @@ -50,7 +50,7 @@ func (a *AbsoluteDeleteOption) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AdHocBackupRuleOptions. func (a AdHocBackupRuleOptions) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "ruleName", a.RuleName) populate(objectMap, "triggerOption", a.TriggerOption) return json.Marshal(objectMap) @@ -81,7 +81,7 @@ func (a *AdHocBackupRuleOptions) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AdhocBackupTriggerOption. func (a AdhocBackupTriggerOption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "retentionTagOverride", a.RetentionTagOverride) return json.Marshal(objectMap) } @@ -108,7 +108,7 @@ func (a *AdhocBackupTriggerOption) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AdhocBasedTaggingCriteria. func (a AdhocBasedTaggingCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "tagInfo", a.TagInfo) return json.Marshal(objectMap) } @@ -135,7 +135,7 @@ func (a *AdhocBasedTaggingCriteria) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AdhocBasedTriggerContext. func (a AdhocBasedTriggerContext) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = "AdhocBasedTriggerContext" populate(objectMap, "taggingCriteria", a.TaggingCriteria) return json.Marshal(objectMap) @@ -166,7 +166,7 @@ func (a *AdhocBasedTriggerContext) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AuthCredentials. func (a AuthCredentials) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = a.ObjectType return json.Marshal(objectMap) } @@ -193,7 +193,8 @@ func (a *AuthCredentials) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureBackupDiscreteRecoveryPoint. func (a AzureBackupDiscreteRecoveryPoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "expiryTime", a.ExpiryTime) populate(objectMap, "friendlyName", a.FriendlyName) objectMap["objectType"] = "AzureBackupDiscreteRecoveryPoint" populate(objectMap, "policyName", a.PolicyName) @@ -216,6 +217,9 @@ func (a *AzureBackupDiscreteRecoveryPoint) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "expiryTime": + err = unpopulateTimeRFC3339(val, "ExpiryTime", &a.ExpiryTime) + delete(rawMsg, key) case "friendlyName": err = unpopulate(val, "FriendlyName", &a.FriendlyName) delete(rawMsg, key) @@ -256,7 +260,7 @@ func (a *AzureBackupDiscreteRecoveryPoint) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureBackupFindRestorableTimeRangesRequest. func (a AzureBackupFindRestorableTimeRangesRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "endTime", a.EndTime) populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) populate(objectMap, "startTime", a.StartTime) @@ -291,7 +295,7 @@ func (a *AzureBackupFindRestorableTimeRangesRequest) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type AzureBackupFindRestorableTimeRangesRequestResource. func (a AzureBackupFindRestorableTimeRangesRequestResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "content", a.Content) populate(objectMap, "cultureInfo", a.CultureInfo) populate(objectMap, "httpMethod", a.HTTPMethod) @@ -346,7 +350,7 @@ func (a *AzureBackupFindRestorableTimeRangesRequestResource) UnmarshalJSON(data // MarshalJSON implements the json.Marshaller interface for type AzureBackupFindRestorableTimeRangesResponse. func (a AzureBackupFindRestorableTimeRangesResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "objectType", a.ObjectType) populate(objectMap, "restorableTimeRanges", a.RestorableTimeRanges) return json.Marshal(objectMap) @@ -377,7 +381,7 @@ func (a *AzureBackupFindRestorableTimeRangesResponse) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type AzureBackupFindRestorableTimeRangesResponseResource. func (a AzureBackupFindRestorableTimeRangesResponseResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) @@ -420,7 +424,7 @@ func (a *AzureBackupFindRestorableTimeRangesResponseResource) UnmarshalJSON(data // MarshalJSON implements the json.Marshaller interface for type AzureBackupJob. func (a AzureBackupJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "activityID", a.ActivityID) populate(objectMap, "backupInstanceFriendlyName", a.BackupInstanceFriendlyName) populate(objectMap, "backupInstanceId", a.BackupInstanceID) @@ -563,7 +567,7 @@ func (a *AzureBackupJob) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureBackupJobResource. func (a AzureBackupJobResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) @@ -606,7 +610,7 @@ func (a *AzureBackupJobResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureBackupJobResourceList. func (a AzureBackupJobResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", a.NextLink) populate(objectMap, "value", a.Value) return json.Marshal(objectMap) @@ -637,7 +641,7 @@ func (a *AzureBackupJobResourceList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureBackupParams. func (a AzureBackupParams) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "backupType", a.BackupType) objectMap["objectType"] = "AzureBackupParams" return json.Marshal(objectMap) @@ -668,7 +672,7 @@ func (a *AzureBackupParams) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryPoint. func (a AzureBackupRecoveryPoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = a.ObjectType return json.Marshal(objectMap) } @@ -695,7 +699,7 @@ func (a *AzureBackupRecoveryPoint) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryPointBasedRestoreRequest. func (a AzureBackupRecoveryPointBasedRestoreRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = "AzureBackupRecoveryPointBasedRestoreRequest" populate(objectMap, "recoveryPointId", a.RecoveryPointID) populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) @@ -738,7 +742,7 @@ func (a *AzureBackupRecoveryPointBasedRestoreRequest) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryPointResource. func (a AzureBackupRecoveryPointResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) @@ -781,7 +785,7 @@ func (a *AzureBackupRecoveryPointResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryPointResourceList. func (a AzureBackupRecoveryPointResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", a.NextLink) populate(objectMap, "value", a.Value) return json.Marshal(objectMap) @@ -812,7 +816,7 @@ func (a *AzureBackupRecoveryPointResourceList) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryTimeBasedRestoreRequest. func (a AzureBackupRecoveryTimeBasedRestoreRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = "AzureBackupRecoveryTimeBasedRestoreRequest" populate(objectMap, "recoveryPointTime", a.RecoveryPointTime) populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) @@ -855,7 +859,7 @@ func (a *AzureBackupRecoveryTimeBasedRestoreRequest) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type AzureBackupRehydrationRequest. func (a AzureBackupRehydrationRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "recoveryPointId", a.RecoveryPointID) populate(objectMap, "rehydrationPriority", a.RehydrationPriority) populate(objectMap, "rehydrationRetentionDuration", a.RehydrationRetentionDuration) @@ -890,7 +894,7 @@ func (a *AzureBackupRehydrationRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureBackupRestoreRequest. func (a AzureBackupRestoreRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = a.ObjectType populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) @@ -929,7 +933,7 @@ func (a *AzureBackupRestoreRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureBackupRestoreWithRehydrationRequest. func (a AzureBackupRestoreWithRehydrationRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = "AzureBackupRestoreWithRehydrationRequest" populate(objectMap, "recoveryPointId", a.RecoveryPointID) populate(objectMap, "rehydrationPriority", a.RehydrationPriority) @@ -980,7 +984,7 @@ func (a *AzureBackupRestoreWithRehydrationRequest) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type AzureBackupRule. func (a AzureBackupRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "backupParameters", a.BackupParameters) populate(objectMap, "dataStore", a.DataStore) populate(objectMap, "name", a.Name) @@ -1023,7 +1027,7 @@ func (a *AzureBackupRule) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureMonitorAlertSettings. func (a AzureMonitorAlertSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "alertsForAllJobFailures", a.AlertsForAllJobFailures) return json.Marshal(objectMap) } @@ -1050,7 +1054,7 @@ func (a *AzureMonitorAlertSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureOperationalStoreParameters. func (a AzureOperationalStoreParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dataStoreType", a.DataStoreType) objectMap["objectType"] = "AzureOperationalStoreParameters" populate(objectMap, "resourceGroupId", a.ResourceGroupID) @@ -1085,7 +1089,7 @@ func (a *AzureOperationalStoreParameters) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AzureRetentionRule. func (a AzureRetentionRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "isDefault", a.IsDefault) populate(objectMap, "lifecycles", a.Lifecycles) populate(objectMap, "name", a.Name) @@ -1124,7 +1128,7 @@ func (a *AzureRetentionRule) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BackupCriteria. func (b BackupCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = b.ObjectType return json.Marshal(objectMap) } @@ -1151,7 +1155,7 @@ func (b *BackupCriteria) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BackupDatasourceParameters. func (b BackupDatasourceParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = b.ObjectType return json.Marshal(objectMap) } @@ -1178,7 +1182,7 @@ func (b *BackupDatasourceParameters) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BackupInstance. func (b BackupInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "currentProtectionState", b.CurrentProtectionState) populate(objectMap, "dataSourceInfo", b.DataSourceInfo) populate(objectMap, "dataSourceSetInfo", b.DataSourceSetInfo) @@ -1245,7 +1249,7 @@ func (b *BackupInstance) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BackupInstanceResource. func (b BackupInstanceResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", b.ID) populate(objectMap, "name", b.Name) populate(objectMap, "properties", b.Properties) @@ -1292,7 +1296,7 @@ func (b *BackupInstanceResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BackupInstanceResourceList. func (b BackupInstanceResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", b.NextLink) populate(objectMap, "value", b.Value) return json.Marshal(objectMap) @@ -1323,7 +1327,7 @@ func (b *BackupInstanceResourceList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BackupParameters. func (b BackupParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = b.ObjectType return json.Marshal(objectMap) } @@ -1350,7 +1354,7 @@ func (b *BackupParameters) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BackupPolicy. func (b BackupPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "datasourceTypes", b.DatasourceTypes) objectMap["objectType"] = "BackupPolicy" populate(objectMap, "policyRules", b.PolicyRules) @@ -1385,7 +1389,7 @@ func (b *BackupPolicy) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BackupSchedule. func (b BackupSchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "repeatingTimeIntervals", b.RepeatingTimeIntervals) populate(objectMap, "timeZone", b.TimeZone) return json.Marshal(objectMap) @@ -1416,7 +1420,8 @@ func (b *BackupSchedule) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BackupVault. func (b BackupVault) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) + populate(objectMap, "featureSettings", b.FeatureSettings) populate(objectMap, "isVaultProtectedByResourceGuard", b.IsVaultProtectedByResourceGuard) populate(objectMap, "monitoringSettings", b.MonitoringSettings) populate(objectMap, "provisioningState", b.ProvisioningState) @@ -1436,6 +1441,9 @@ func (b *BackupVault) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "featureSettings": + err = unpopulate(val, "FeatureSettings", &b.FeatureSettings) + delete(rawMsg, key) case "isVaultProtectedByResourceGuard": err = unpopulate(val, "IsVaultProtectedByResourceGuard", &b.IsVaultProtectedByResourceGuard) delete(rawMsg, key) @@ -1467,7 +1475,7 @@ func (b *BackupVault) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BackupVaultResource. func (b BackupVaultResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "eTag", b.ETag) populate(objectMap, "id", b.ID) populate(objectMap, "identity", b.Identity) @@ -1526,7 +1534,7 @@ func (b *BackupVaultResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BackupVaultResourceList. func (b BackupVaultResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", b.NextLink) populate(objectMap, "value", b.Value) return json.Marshal(objectMap) @@ -1557,7 +1565,7 @@ func (b *BackupVaultResourceList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BaseBackupPolicy. func (b BaseBackupPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "datasourceTypes", b.DatasourceTypes) objectMap["objectType"] = b.ObjectType return json.Marshal(objectMap) @@ -1588,7 +1596,7 @@ func (b *BaseBackupPolicy) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BaseBackupPolicyResource. func (b BaseBackupPolicyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", b.ID) populate(objectMap, "name", b.Name) populate(objectMap, "properties", b.Properties) @@ -1631,7 +1639,7 @@ func (b *BaseBackupPolicyResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BaseBackupPolicyResourceList. func (b BaseBackupPolicyResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", b.NextLink) populate(objectMap, "value", b.Value) return json.Marshal(objectMap) @@ -1662,7 +1670,7 @@ func (b *BaseBackupPolicyResourceList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BasePolicyRule. func (b BasePolicyRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", b.Name) objectMap["objectType"] = b.ObjectType return json.Marshal(objectMap) @@ -1693,7 +1701,7 @@ func (b *BasePolicyRule) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type BlobBackupDatasourceParameters. func (b BlobBackupDatasourceParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "containersList", b.ContainersList) objectMap["objectType"] = "BlobBackupDatasourceParameters" return json.Marshal(objectMap) @@ -1724,7 +1732,7 @@ func (b *BlobBackupDatasourceParameters) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityRequest. func (c CheckNameAvailabilityRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", c.Name) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) @@ -1755,7 +1763,7 @@ func (c *CheckNameAvailabilityRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityResult. func (c CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "message", c.Message) populate(objectMap, "nameAvailable", c.NameAvailable) populate(objectMap, "reason", c.Reason) @@ -1790,7 +1798,7 @@ func (c *CheckNameAvailabilityResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ClientDiscoveryDisplay. func (c ClientDiscoveryDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "description", c.Description) populate(objectMap, "operation", c.Operation) populate(objectMap, "provider", c.Provider) @@ -1829,7 +1837,7 @@ func (c *ClientDiscoveryDisplay) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ClientDiscoveryForLogSpecification. func (c ClientDiscoveryForLogSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "blobDuration", c.BlobDuration) populate(objectMap, "displayName", c.DisplayName) populate(objectMap, "name", c.Name) @@ -1864,7 +1872,7 @@ func (c *ClientDiscoveryForLogSpecification) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ClientDiscoveryForProperties. func (c ClientDiscoveryForProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "serviceSpecification", c.ServiceSpecification) return json.Marshal(objectMap) } @@ -1891,7 +1899,7 @@ func (c *ClientDiscoveryForProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ClientDiscoveryForServiceSpecification. func (c ClientDiscoveryForServiceSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "logSpecifications", c.LogSpecifications) return json.Marshal(objectMap) } @@ -1918,7 +1926,7 @@ func (c *ClientDiscoveryForServiceSpecification) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type ClientDiscoveryResponse. func (c ClientDiscoveryResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", c.NextLink) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) @@ -1949,7 +1957,7 @@ func (c *ClientDiscoveryResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ClientDiscoveryValueForSingleAPI. func (c ClientDiscoveryValueForSingleAPI) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "display", c.Display) populate(objectMap, "isDataAction", c.IsDataAction) populate(objectMap, "name", c.Name) @@ -1992,7 +2000,7 @@ func (c *ClientDiscoveryValueForSingleAPI) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CopyOnExpiryOption. func (c CopyOnExpiryOption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = "CopyOnExpiryOption" return json.Marshal(objectMap) } @@ -2019,7 +2027,7 @@ func (c *CopyOnExpiryOption) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CopyOption. func (c CopyOption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = c.ObjectType return json.Marshal(objectMap) } @@ -2044,9 +2052,36 @@ func (c *CopyOption) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CrossSubscriptionRestoreSettings. +func (c CrossSubscriptionRestoreSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "state", c.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CrossSubscriptionRestoreSettings. +func (c *CrossSubscriptionRestoreSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &c.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CustomCopyOption. func (c CustomCopyOption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "duration", c.Duration) objectMap["objectType"] = "CustomCopyOption" return json.Marshal(objectMap) @@ -2077,7 +2112,7 @@ func (c *CustomCopyOption) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataStoreInfoBase. func (d DataStoreInfoBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dataStoreType", d.DataStoreType) populate(objectMap, "objectType", d.ObjectType) return json.Marshal(objectMap) @@ -2108,7 +2143,7 @@ func (d *DataStoreInfoBase) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataStoreParameters. func (d DataStoreParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dataStoreType", d.DataStoreType) objectMap["objectType"] = d.ObjectType return json.Marshal(objectMap) @@ -2139,7 +2174,7 @@ func (d *DataStoreParameters) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Datasource. func (d Datasource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "datasourceType", d.DatasourceType) populate(objectMap, "objectType", d.ObjectType) populate(objectMap, "resourceID", d.ResourceID) @@ -2190,7 +2225,7 @@ func (d *Datasource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DatasourceSet. func (d DatasourceSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "datasourceType", d.DatasourceType) populate(objectMap, "objectType", d.ObjectType) populate(objectMap, "resourceID", d.ResourceID) @@ -2241,7 +2276,7 @@ func (d *DatasourceSet) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Day. func (d Day) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "date", d.Date) populate(objectMap, "isLast", d.IsLast) return json.Marshal(objectMap) @@ -2272,7 +2307,7 @@ func (d *Day) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DeleteOption. func (d DeleteOption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "duration", d.Duration) objectMap["objectType"] = d.ObjectType return json.Marshal(objectMap) @@ -2303,7 +2338,7 @@ func (d *DeleteOption) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DeletedBackupInstance. func (d DeletedBackupInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "currentProtectionState", d.CurrentProtectionState) populate(objectMap, "dataSourceInfo", d.DataSourceInfo) populate(objectMap, "dataSourceSetInfo", d.DataSourceSetInfo) @@ -2374,7 +2409,7 @@ func (d *DeletedBackupInstance) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DeletedBackupInstanceResource. func (d DeletedBackupInstanceResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) populate(objectMap, "properties", d.Properties) @@ -2417,7 +2452,7 @@ func (d *DeletedBackupInstanceResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DeletedBackupInstanceResourceList. func (d DeletedBackupInstanceResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) @@ -2448,7 +2483,7 @@ func (d *DeletedBackupInstanceResourceList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DeletionInfo. func (d DeletionInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "billingEndDate", d.BillingEndDate) populate(objectMap, "deleteActivityID", d.DeleteActivityID) populate(objectMap, "deletionTime", d.DeletionTime) @@ -2487,7 +2522,7 @@ func (d *DeletionInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DppBaseResource. func (d DppBaseResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) populate(objectMap, "type", d.Type) @@ -2522,7 +2557,7 @@ func (d *DppBaseResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DppBaseResourceList. func (d DppBaseResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) @@ -2551,9 +2586,60 @@ func (d *DppBaseResourceList) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DppBaseTrackedResource. +func (d DppBaseTrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eTag", d.ETag) + populate(objectMap, "id", d.ID) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DppBaseTrackedResource. +func (d *DppBaseTrackedResource) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eTag": + err = unpopulate(val, "ETag", &d.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DppIdentityDetails. func (d DppIdentityDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "principalId", d.PrincipalID) populate(objectMap, "tenantId", d.TenantID) populate(objectMap, "type", d.Type) @@ -2588,7 +2674,7 @@ func (d *DppIdentityDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DppProxyResource. func (d DppProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) populate(objectMap, "systemData", d.SystemData) @@ -2631,7 +2717,7 @@ func (d *DppProxyResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DppResource. func (d DppResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) populate(objectMap, "systemData", d.SystemData) @@ -2670,7 +2756,7 @@ func (d *DppResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DppResourceList. func (d DppResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", d.NextLink) return json.Marshal(objectMap) } @@ -2697,7 +2783,7 @@ func (d *DppResourceList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DppTrackedResource. func (d DppTrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "eTag", d.ETag) populate(objectMap, "id", d.ID) populate(objectMap, "identity", d.Identity) @@ -2752,7 +2838,7 @@ func (d *DppTrackedResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DppTrackedResourceList. func (d DppTrackedResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", d.NextLink) return json.Marshal(objectMap) } @@ -2779,7 +2865,7 @@ func (d *DppTrackedResourceList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DppWorkerRequest. func (d DppWorkerRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "cultureInfo", d.CultureInfo) populate(objectMap, "httpMethod", d.HTTPMethod) populate(objectMap, "headers", d.Headers) @@ -2830,7 +2916,7 @@ func (d *DppWorkerRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Error. func (e Error) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) populate(objectMap, "details", e.Details) @@ -2873,7 +2959,7 @@ func (e *Error) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "info", &e.Info) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) @@ -2904,7 +2990,7 @@ func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ExportJobsResult. func (e ExportJobsResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "blobSasKey", e.BlobSasKey) populate(objectMap, "blobUrl", e.BlobURL) populate(objectMap, "excelFileBlobSasKey", e.ExcelFileBlobSasKey) @@ -2941,9 +3027,36 @@ func (e *ExportJobsResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type FeatureSettings. +func (f FeatureSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "crossSubscriptionRestoreSettings", f.CrossSubscriptionRestoreSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FeatureSettings. +func (f *FeatureSettings) 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "crossSubscriptionRestoreSettings": + err = unpopulate(val, "CrossSubscriptionRestoreSettings", &f.CrossSubscriptionRestoreSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type FeatureValidationRequest. func (f FeatureValidationRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "featureName", f.FeatureName) populate(objectMap, "featureType", f.FeatureType) objectMap["objectType"] = "FeatureValidationRequest" @@ -2978,7 +3091,7 @@ func (f *FeatureValidationRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FeatureValidationRequestBase. func (f FeatureValidationRequestBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = f.ObjectType return json.Marshal(objectMap) } @@ -3005,7 +3118,7 @@ func (f *FeatureValidationRequestBase) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FeatureValidationResponse. func (f FeatureValidationResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "featureType", f.FeatureType) populate(objectMap, "features", f.Features) objectMap["objectType"] = "FeatureValidationResponse" @@ -3040,7 +3153,7 @@ func (f *FeatureValidationResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FeatureValidationResponseBase. func (f FeatureValidationResponseBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = f.ObjectType return json.Marshal(objectMap) } @@ -3067,7 +3180,7 @@ func (f *FeatureValidationResponseBase) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ImmediateCopyOption. func (i ImmediateCopyOption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = "ImmediateCopyOption" return json.Marshal(objectMap) } @@ -3094,7 +3207,7 @@ func (i *ImmediateCopyOption) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ImmutabilitySettings. func (i ImmutabilitySettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "state", i.State) return json.Marshal(objectMap) } @@ -3121,7 +3234,7 @@ func (i *ImmutabilitySettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type InnerError. func (i InnerError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "additionalInfo", i.AdditionalInfo) populate(objectMap, "code", i.Code) populate(objectMap, "embeddedInnerError", i.EmbeddedInnerError) @@ -3156,7 +3269,7 @@ func (i *InnerError) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ItemLevelRestoreCriteria. func (i ItemLevelRestoreCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = i.ObjectType return json.Marshal(objectMap) } @@ -3183,7 +3296,7 @@ func (i *ItemLevelRestoreCriteria) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ItemLevelRestoreTargetInfo. func (i ItemLevelRestoreTargetInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "datasourceAuthCredentials", i.DatasourceAuthCredentials) populate(objectMap, "datasourceInfo", i.DatasourceInfo) populate(objectMap, "datasourceSetInfo", i.DatasourceSetInfo) @@ -3234,7 +3347,7 @@ func (i *ItemLevelRestoreTargetInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ItemPathBasedRestoreCriteria. func (i ItemPathBasedRestoreCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "isPathRelativeToBackupItem", i.IsPathRelativeToBackupItem) populate(objectMap, "itemPath", i.ItemPath) objectMap["objectType"] = "ItemPathBasedRestoreCriteria" @@ -3273,7 +3386,7 @@ func (i *ItemPathBasedRestoreCriteria) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type JobExtendedInfo. func (j JobExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "additionalDetails", j.AdditionalDetails) populate(objectMap, "backupInstanceState", j.BackupInstanceState) populate(objectMap, "dataTransferredInBytes", j.DataTransferredInBytes) @@ -3324,7 +3437,7 @@ func (j *JobExtendedInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type JobSubTask. func (j JobSubTask) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "additionalDetails", j.AdditionalDetails) populate(objectMap, "taskId", j.TaskID) populate(objectMap, "taskName", j.TaskName) @@ -3367,7 +3480,7 @@ func (j *JobSubTask) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type KubernetesClusterBackupDatasourceParameters. func (k KubernetesClusterBackupDatasourceParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "excludedNamespaces", k.ExcludedNamespaces) populate(objectMap, "excludedResourceTypes", k.ExcludedResourceTypes) populate(objectMap, "includeClusterScopeResources", k.IncludeClusterScopeResources) @@ -3422,7 +3535,7 @@ func (k *KubernetesClusterBackupDatasourceParameters) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type KubernetesClusterRestoreCriteria. func (k KubernetesClusterRestoreCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "conflictPolicy", k.ConflictPolicy) populate(objectMap, "excludedNamespaces", k.ExcludedNamespaces) populate(objectMap, "excludedResourceTypes", k.ExcludedResourceTypes) @@ -3485,7 +3598,7 @@ func (k *KubernetesClusterRestoreCriteria) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type KubernetesPVRestoreCriteria. func (k KubernetesPVRestoreCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", k.Name) objectMap["objectType"] = "KubernetesPVRestoreCriteria" populate(objectMap, "storageClassName", k.StorageClassName) @@ -3520,7 +3633,7 @@ func (k *KubernetesPVRestoreCriteria) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type KubernetesStorageClassRestoreCriteria. func (k KubernetesStorageClassRestoreCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = "KubernetesStorageClassRestoreCriteria" populate(objectMap, "provisioner", k.Provisioner) populate(objectMap, "selectedStorageClassName", k.SelectedStorageClassName) @@ -3555,7 +3668,7 @@ func (k *KubernetesStorageClassRestoreCriteria) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type MonitoringSettings. func (m MonitoringSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "azureMonitorAlertSettings", m.AzureMonitorAlertSettings) return json.Marshal(objectMap) } @@ -3582,7 +3695,7 @@ func (m *MonitoringSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationExtendedInfo. func (o OperationExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = o.ObjectType return json.Marshal(objectMap) } @@ -3609,7 +3722,7 @@ func (o *OperationExtendedInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationJobExtendedInfo. func (o OperationJobExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "jobId", o.JobID) objectMap["objectType"] = "OperationJobExtendedInfo" return json.Marshal(objectMap) @@ -3640,7 +3753,7 @@ func (o *OperationJobExtendedInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationResource. func (o OperationResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "endTime", o.EndTime) populate(objectMap, "error", o.Error) populate(objectMap, "id", o.ID) @@ -3691,7 +3804,8 @@ func (o *OperationResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PatchBackupVaultInput. func (p PatchBackupVaultInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) + populate(objectMap, "featureSettings", p.FeatureSettings) populate(objectMap, "monitoringSettings", p.MonitoringSettings) populate(objectMap, "securitySettings", p.SecuritySettings) return json.Marshal(objectMap) @@ -3706,6 +3820,9 @@ func (p *PatchBackupVaultInput) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "featureSettings": + err = unpopulate(val, "FeatureSettings", &p.FeatureSettings) + delete(rawMsg, key) case "monitoringSettings": err = unpopulate(val, "MonitoringSettings", &p.MonitoringSettings) delete(rawMsg, key) @@ -3720,9 +3837,36 @@ func (p *PatchBackupVaultInput) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PatchResourceGuardInput. +func (p PatchResourceGuardInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchResourceGuardInput. +func (p *PatchResourceGuardInput) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type PatchResourceRequestInput. func (p PatchResourceRequestInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "identity", p.Identity) populate(objectMap, "properties", p.Properties) populate(objectMap, "tags", p.Tags) @@ -3757,7 +3901,7 @@ func (p *PatchResourceRequestInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PolicyInfo. func (p PolicyInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "policyId", p.PolicyID) populate(objectMap, "policyParameters", p.PolicyParameters) populate(objectMap, "policyVersion", p.PolicyVersion) @@ -3792,7 +3936,7 @@ func (p *PolicyInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PolicyParameters. func (p PolicyParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "backupDatasourceParametersList", p.BackupDatasourceParametersList) populate(objectMap, "dataStoreParametersList", p.DataStoreParametersList) return json.Marshal(objectMap) @@ -3823,7 +3967,7 @@ func (p *PolicyParameters) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProtectionStatusDetails. func (p ProtectionStatusDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "errorDetails", p.ErrorDetails) populate(objectMap, "status", p.Status) return json.Marshal(objectMap) @@ -3854,7 +3998,7 @@ func (p *ProtectionStatusDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RangeBasedItemLevelRestoreCriteria. func (r RangeBasedItemLevelRestoreCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "maxMatchingValue", r.MaxMatchingValue) populate(objectMap, "minMatchingValue", r.MinMatchingValue) objectMap["objectType"] = "RangeBasedItemLevelRestoreCriteria" @@ -3889,7 +4033,7 @@ func (r *RangeBasedItemLevelRestoreCriteria) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPointDataStoreDetails. func (r RecoveryPointDataStoreDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "creationTime", r.CreationTime) populateTimeRFC3339(objectMap, "expiryTime", r.ExpiryTime) populate(objectMap, "id", r.ID) @@ -3948,7 +4092,7 @@ func (r *RecoveryPointDataStoreDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RecoveryPointsFilters. func (r RecoveryPointsFilters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "endDate", r.EndDate) populate(objectMap, "extendedInfo", r.ExtendedInfo) populate(objectMap, "isVisible", r.IsVisible) @@ -3995,7 +4139,7 @@ func (r *RecoveryPointsFilters) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceGuard. func (r ResourceGuard) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allowAutoApprovals", r.AllowAutoApprovals) populate(objectMap, "description", r.Description) populate(objectMap, "provisioningState", r.ProvisioningState) @@ -4038,7 +4182,7 @@ func (r *ResourceGuard) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceGuardOperation. func (r ResourceGuardOperation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "requestResourceType", r.RequestResourceType) populate(objectMap, "vaultCriticalOperation", r.VaultCriticalOperation) return json.Marshal(objectMap) @@ -4067,156 +4211,11 @@ func (r *ResourceGuardOperation) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceGuardOperationDetail. -func (r ResourceGuardOperationDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "defaultResourceRequest", r.DefaultResourceRequest) - populate(objectMap, "vaultCriticalOperation", r.VaultCriticalOperation) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGuardOperationDetail. -func (r *ResourceGuardOperationDetail) 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 "defaultResourceRequest": - err = unpopulate(val, "DefaultResourceRequest", &r.DefaultResourceRequest) - delete(rawMsg, key) - case "vaultCriticalOperation": - err = unpopulate(val, "VaultCriticalOperation", &r.VaultCriticalOperation) - 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 ResourceGuardProxyBase. -func (r ResourceGuardProxyBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", r.Description) - populate(objectMap, "lastUpdatedTime", r.LastUpdatedTime) - populate(objectMap, "resourceGuardOperationDetails", r.ResourceGuardOperationDetails) - populate(objectMap, "resourceGuardResourceId", r.ResourceGuardResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGuardProxyBase. -func (r *ResourceGuardProxyBase) 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 "description": - err = unpopulate(val, "Description", &r.Description) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulate(val, "LastUpdatedTime", &r.LastUpdatedTime) - delete(rawMsg, key) - case "resourceGuardOperationDetails": - err = unpopulate(val, "ResourceGuardOperationDetails", &r.ResourceGuardOperationDetails) - delete(rawMsg, key) - case "resourceGuardResourceId": - err = unpopulate(val, "ResourceGuardResourceID", &r.ResourceGuardResourceID) - 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 ResourceGuardProxyBaseResource. -func (r ResourceGuardProxyBaseResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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 ResourceGuardProxyBaseResource. -func (r *ResourceGuardProxyBaseResource) 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 ResourceGuardProxyBaseResourceList. -func (r ResourceGuardProxyBaseResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGuardProxyBaseResourceList. -func (r *ResourceGuardProxyBaseResourceList) 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 ResourceGuardResource. func (r ResourceGuardResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "eTag", r.ETag) populate(objectMap, "id", r.ID) - populate(objectMap, "identity", r.Identity) populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) populate(objectMap, "properties", r.Properties) @@ -4241,9 +4240,6 @@ func (r *ResourceGuardResource) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &r.Identity) - delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &r.Location) delete(rawMsg, key) @@ -4272,7 +4268,7 @@ func (r *ResourceGuardResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceGuardResourceList. func (r ResourceGuardResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", r.NextLink) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) @@ -4303,7 +4299,7 @@ func (r *ResourceGuardResourceList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceMoveDetails. func (r ResourceMoveDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "completionTimeUtc", r.CompletionTimeUTC) populate(objectMap, "operationId", r.OperationID) populate(objectMap, "sourceResourcePath", r.SourceResourcePath) @@ -4346,7 +4342,7 @@ func (r *ResourceMoveDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RestorableTimeRange. func (r RestorableTimeRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "endTime", r.EndTime) populate(objectMap, "objectType", r.ObjectType) populate(objectMap, "startTime", r.StartTime) @@ -4381,7 +4377,7 @@ func (r *RestorableTimeRange) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RestoreFilesTargetInfo. func (r RestoreFilesTargetInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = "RestoreFilesTargetInfo" populate(objectMap, "recoveryOption", r.RecoveryOption) populate(objectMap, "restoreLocation", r.RestoreLocation) @@ -4420,7 +4416,7 @@ func (r *RestoreFilesTargetInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RestoreJobRecoveryPointDetails. func (r RestoreJobRecoveryPointDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "recoveryPointID", r.RecoveryPointID) populateTimeRFC3339(objectMap, "recoveryPointTime", r.RecoveryPointTime) return json.Marshal(objectMap) @@ -4451,7 +4447,7 @@ func (r *RestoreJobRecoveryPointDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RestoreTargetInfo. func (r RestoreTargetInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "datasourceAuthCredentials", r.DatasourceAuthCredentials) populate(objectMap, "datasourceInfo", r.DatasourceInfo) populate(objectMap, "datasourceSetInfo", r.DatasourceSetInfo) @@ -4498,7 +4494,7 @@ func (r *RestoreTargetInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RestoreTargetInfoBase. func (r RestoreTargetInfoBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = r.ObjectType populate(objectMap, "recoveryOption", r.RecoveryOption) populate(objectMap, "restoreLocation", r.RestoreLocation) @@ -4533,7 +4529,7 @@ func (r *RestoreTargetInfoBase) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RetentionTag. func (r RetentionTag) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "eTag", r.ETag) populate(objectMap, "id", r.ID) populate(objectMap, "tagName", r.TagName) @@ -4568,7 +4564,7 @@ func (r *RetentionTag) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScheduleBasedBackupCriteria. func (s ScheduleBasedBackupCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "absoluteCriteria", s.AbsoluteCriteria) populate(objectMap, "daysOfMonth", s.DaysOfMonth) populate(objectMap, "daysOfTheWeek", s.DaysOfTheWeek) @@ -4627,7 +4623,7 @@ func (s *ScheduleBasedBackupCriteria) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScheduleBasedTriggerContext. func (s ScheduleBasedTriggerContext) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = "ScheduleBasedTriggerContext" populate(objectMap, "schedule", s.Schedule) populate(objectMap, "taggingCriteria", s.TaggingCriteria) @@ -4662,7 +4658,7 @@ func (s *ScheduleBasedTriggerContext) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SecretStoreBasedAuthCredentials. func (s SecretStoreBasedAuthCredentials) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = "SecretStoreBasedAuthCredentials" populate(objectMap, "secretStoreResource", s.SecretStoreResource) return json.Marshal(objectMap) @@ -4693,7 +4689,7 @@ func (s *SecretStoreBasedAuthCredentials) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SecretStoreResource. func (s SecretStoreResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "secretStoreType", s.SecretStoreType) populate(objectMap, "uri", s.URI) populate(objectMap, "value", s.Value) @@ -4728,7 +4724,7 @@ func (s *SecretStoreResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SecuritySettings. func (s SecuritySettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "immutabilitySettings", s.ImmutabilitySettings) populate(objectMap, "softDeleteSettings", s.SoftDeleteSettings) return json.Marshal(objectMap) @@ -4759,7 +4755,7 @@ func (s *SecuritySettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SoftDeleteSettings. func (s SoftDeleteSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "retentionDurationInDays", s.RetentionDurationInDays) populate(objectMap, "state", s.State) return json.Marshal(objectMap) @@ -4790,7 +4786,7 @@ func (s *SoftDeleteSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SourceLifeCycle. func (s SourceLifeCycle) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "deleteAfter", s.DeleteAfter) populate(objectMap, "sourceDataStore", s.SourceDataStore) populate(objectMap, "targetDataStoreCopySettings", s.TargetDataStoreCopySettings) @@ -4825,7 +4821,7 @@ func (s *SourceLifeCycle) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type StorageSetting. func (s StorageSetting) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "datastoreType", s.DatastoreType) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) @@ -4856,7 +4852,7 @@ func (s *StorageSetting) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SupportedFeature. func (s SupportedFeature) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "exposureControlledFeatures", s.ExposureControlledFeatures) populate(objectMap, "featureName", s.FeatureName) populate(objectMap, "supportStatus", s.SupportStatus) @@ -4891,7 +4887,7 @@ func (s *SupportedFeature) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SyncBackupInstanceRequest. func (s SyncBackupInstanceRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "syncType", s.SyncType) return json.Marshal(objectMap) } @@ -4918,7 +4914,7 @@ func (s *SyncBackupInstanceRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) @@ -4965,7 +4961,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TaggingCriteria. func (t TaggingCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "criteria", t.Criteria) populate(objectMap, "isDefault", t.IsDefault) populate(objectMap, "tagInfo", t.TagInfo) @@ -5004,7 +5000,7 @@ func (t *TaggingCriteria) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TargetCopySetting. func (t TargetCopySetting) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "copyAfter", t.CopyAfter) populate(objectMap, "dataStore", t.DataStore) return json.Marshal(objectMap) @@ -5035,9 +5031,10 @@ func (t *TargetCopySetting) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TargetDetails. func (t TargetDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "filePrefix", t.FilePrefix) populate(objectMap, "restoreTargetLocationType", t.RestoreTargetLocationType) + populate(objectMap, "targetResourceArmId", t.TargetResourceArmID) populate(objectMap, "url", t.URL) return json.Marshal(objectMap) } @@ -5057,6 +5054,9 @@ func (t *TargetDetails) UnmarshalJSON(data []byte) error { case "restoreTargetLocationType": err = unpopulate(val, "RestoreTargetLocationType", &t.RestoreTargetLocationType) delete(rawMsg, key) + case "targetResourceArmId": + err = unpopulate(val, "TargetResourceArmID", &t.TargetResourceArmID) + delete(rawMsg, key) case "url": err = unpopulate(val, "URL", &t.URL) delete(rawMsg, key) @@ -5070,7 +5070,7 @@ func (t *TargetDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TriggerBackupRequest. func (t TriggerBackupRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "backupRuleOptions", t.BackupRuleOptions) return json.Marshal(objectMap) } @@ -5097,7 +5097,7 @@ func (t *TriggerBackupRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TriggerContext. func (t TriggerContext) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["objectType"] = t.ObjectType return json.Marshal(objectMap) } @@ -5122,67 +5122,9 @@ func (t *TriggerContext) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type UnlockDeleteRequest. -func (u UnlockDeleteRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "resourceGuardOperationRequests", u.ResourceGuardOperationRequests) - populate(objectMap, "resourceToBeDeleted", u.ResourceToBeDeleted) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UnlockDeleteRequest. -func (u *UnlockDeleteRequest) 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", u, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "resourceGuardOperationRequests": - err = unpopulate(val, "ResourceGuardOperationRequests", &u.ResourceGuardOperationRequests) - delete(rawMsg, key) - case "resourceToBeDeleted": - err = unpopulate(val, "ResourceToBeDeleted", &u.ResourceToBeDeleted) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type UnlockDeleteResponse. -func (u UnlockDeleteResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "unlockDeleteExpiryTime", u.UnlockDeleteExpiryTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UnlockDeleteResponse. -func (u *UnlockDeleteResponse) 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", u, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "unlockDeleteExpiryTime": - err = unpopulate(val, "UnlockDeleteExpiryTime", &u.UnlockDeleteExpiryTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type UserFacingError. func (u UserFacingError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "code", u.Code) populate(objectMap, "details", u.Details) populate(objectMap, "innerError", u.InnerError) @@ -5241,7 +5183,7 @@ func (u *UserFacingError) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ValidateForBackupRequest. func (v ValidateForBackupRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "backupInstance", v.BackupInstance) return json.Marshal(objectMap) } @@ -5268,7 +5210,7 @@ func (v *ValidateForBackupRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ValidateRestoreRequestObject. func (v ValidateRestoreRequestObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "restoreRequestObject", v.RestoreRequestObject) return json.Marshal(objectMap) } @@ -5293,7 +5235,7 @@ func (v *ValidateRestoreRequestObject) UnmarshalJSON(data []byte) error { return nil } -func populate(m map[string]interface{}, k string, v interface{}) { +func populate(m map[string]any, k string, v any) { if v == nil { return } else if azcore.IsNullValue(v) { @@ -5303,7 +5245,7 @@ func populate(m map[string]interface{}, k string, v interface{}) { } } -func unpopulate(data json.RawMessage, fn string, v interface{}) error { +func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client.go index 94cd009b9216..f93e72d38ce8 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client.go @@ -33,9 +33,9 @@ type OperationResultClient struct { } // NewOperationResultClient creates a new instance of OperationResultClient with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewOperationResultClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationResultClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -58,8 +58,9 @@ func NewOperationResultClient(subscriptionID string, credential azcore.TokenCred // Get - Gets the operation result for a resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// options - OperationResultClientGetOptions contains the optional parameters for the OperationResultClient.Get method. +// +// Generated from API version 2023-01-01 +// - options - OperationResultClientGetOptions contains the optional parameters for the OperationResultClient.Get method. func (client *OperationResultClient) Get(ctx context.Context, operationID string, location string, options *OperationResultClientGetOptions) (OperationResultClientGetResponse, error) { req, err := client.getCreateRequest(ctx, operationID, location, options) if err != nil { @@ -78,9 +79,6 @@ func (client *OperationResultClient) Get(ctx context.Context, operationID string // getCreateRequest creates the Get request. func (client *OperationResultClient) getCreateRequest(ctx context.Context, operationID string, location string, options *OperationResultClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationResults/{operationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if operationID == "" { return nil, errors.New("parameter operationID cannot be empty") @@ -95,7 +93,7 @@ func (client *OperationResultClient) getCreateRequest(ctx context.Context, opera return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client_example_test.go deleted file mode 100644 index 1c8f557ac452..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client_example_test.go +++ /dev/null @@ -1,36 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationResult.json -func ExampleOperationResultClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewOperationResultClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA==", "WestUS", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operations_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/operations_client.go index 712920796bf1..a5da34d7471a 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operations_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/operations_client.go @@ -28,8 +28,8 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -50,8 +50,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Returns the list of available operations. -// Generated from API version 2022-11-01-preview -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// +// Generated from API version 2023-01-01 +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ More: func(page OperationsClientListResponse) bool { @@ -88,7 +89,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operations_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/operations_client_example_test.go deleted file mode 100644 index f76b5f63ebf1..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operations_client_example_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/Operations/List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client.go index 52fc09dba7e2..e445a9a64a2e 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client.go @@ -32,9 +32,9 @@ type OperationStatusClient struct { } // NewOperationStatusClient creates a new instance of OperationStatusClient with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,8 +57,9 @@ func NewOperationStatusClient(subscriptionID string, credential azcore.TokenCred // Get - Gets the operation status for a resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// options - OperationStatusClientGetOptions contains the optional parameters for the OperationStatusClient.Get method. +// +// Generated from API version 2023-01-01 +// - options - OperationStatusClientGetOptions contains the optional parameters for the OperationStatusClient.Get method. func (client *OperationStatusClient) Get(ctx context.Context, location string, operationID string, options *OperationStatusClientGetOptions) (OperationStatusClientGetResponse, error) { req, err := client.getCreateRequest(ctx, location, operationID, options) if err != nil { @@ -77,9 +78,6 @@ func (client *OperationStatusClient) Get(ctx context.Context, location string, o // getCreateRequest creates the Get request. func (client *OperationStatusClient) getCreateRequest(ctx context.Context, location string, operationID string, options *OperationStatusClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus/{operationId}" - 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") @@ -94,7 +92,7 @@ func (client *OperationStatusClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client_example_test.go deleted file mode 100644 index e5a93782c7b3..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client_example_test.go +++ /dev/null @@ -1,36 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatus.json -func ExampleOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewOperationStatusClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "WestUS", "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA==", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client.go index e31fa3c3a5a8..a1677dfe899a 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client.go @@ -32,9 +32,9 @@ type OperationStatusBackupVaultContextClient struct { } // NewOperationStatusBackupVaultContextClient creates a new instance of OperationStatusBackupVaultContextClient with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewOperationStatusBackupVaultContextClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusBackupVaultContextClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,11 +57,12 @@ func NewOperationStatusBackupVaultContextClient(subscriptionID string, credentia // Get - Gets the operation status for an operation over a BackupVault's context. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// options - OperationStatusBackupVaultContextClientGetOptions contains the optional parameters for the OperationStatusBackupVaultContextClient.Get -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - options - OperationStatusBackupVaultContextClientGetOptions contains the optional parameters for the OperationStatusBackupVaultContextClient.Get +// method. func (client *OperationStatusBackupVaultContextClient) Get(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *OperationStatusBackupVaultContextClientGetOptions) (OperationStatusBackupVaultContextClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, operationID, options) if err != nil { @@ -80,9 +81,6 @@ func (client *OperationStatusBackupVaultContextClient) Get(ctx context.Context, // getCreateRequest creates the Get request. func (client *OperationStatusBackupVaultContextClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *OperationStatusBackupVaultContextClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationStatus/{operationId}" - 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") @@ -101,7 +99,7 @@ func (client *OperationStatusBackupVaultContextClient) getCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client_example_test.go deleted file mode 100644 index 52dab3b8b914..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client_example_test.go +++ /dev/null @@ -1,36 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatusVaultContext.json -func ExampleOperationStatusBackupVaultContextClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewOperationStatusBackupVaultContextClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "SampleResourceGroup", "swaggerExample", "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA==", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client.go index a39d0f5ada78..23c99e72536e 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client.go @@ -32,9 +32,9 @@ type OperationStatusResourceGroupContextClient struct { } // NewOperationStatusResourceGroupContextClient creates a new instance of OperationStatusResourceGroupContextClient with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewOperationStatusResourceGroupContextClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusResourceGroupContextClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,10 +57,11 @@ func NewOperationStatusResourceGroupContextClient(subscriptionID string, credent // Get - Gets the operation status for an operation over a ResourceGroup's context. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// options - OperationStatusResourceGroupContextClientGetOptions contains the optional parameters for the OperationStatusResourceGroupContextClient.Get -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - OperationStatusResourceGroupContextClientGetOptions contains the optional parameters for the OperationStatusResourceGroupContextClient.Get +// method. func (client *OperationStatusResourceGroupContextClient) Get(ctx context.Context, resourceGroupName string, operationID string, options *OperationStatusResourceGroupContextClientGetOptions) (OperationStatusResourceGroupContextClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, operationID, options) if err != nil { @@ -83,9 +84,6 @@ func (client *OperationStatusResourceGroupContextClient) getCreateRequest(ctx co return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if operationID == "" { return nil, errors.New("parameter operationID cannot be empty") @@ -96,7 +94,7 @@ func (client *OperationStatusResourceGroupContextClient) getCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client_example_test.go deleted file mode 100644 index d10b7f2edd42..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client_example_test.go +++ /dev/null @@ -1,36 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatusRGContext.json -func ExampleOperationStatusResourceGroupContextClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewOperationStatusResourceGroupContextClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "SampleResourceGroup", "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA==", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/polymorphic_helpers.go b/sdk/resourcemanager/dataprotection/armdataprotection/polymorphic_helpers.go index 93aa96364bf2..6844a467f6f5 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/polymorphic_helpers.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/polymorphic_helpers.go @@ -15,7 +15,7 @@ func unmarshalAuthCredentialsClassification(rawMsg json.RawMessage) (AuthCredent if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -33,7 +33,7 @@ func unmarshalAzureBackupRecoveryPointClassification(rawMsg json.RawMessage) (Az if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -51,7 +51,7 @@ func unmarshalAzureBackupRestoreRequestClassification(rawMsg json.RawMessage) (A if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -73,7 +73,7 @@ func unmarshalBackupCriteriaClassification(rawMsg json.RawMessage) (BackupCriter if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -110,7 +110,7 @@ func unmarshalBackupDatasourceParametersClassification(rawMsg json.RawMessage) ( if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -149,7 +149,7 @@ func unmarshalBackupParametersClassification(rawMsg json.RawMessage) (BackupPara if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -167,7 +167,7 @@ func unmarshalBaseBackupPolicyClassification(rawMsg json.RawMessage) (BaseBackup if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -185,7 +185,7 @@ func unmarshalBasePolicyRuleClassification(rawMsg json.RawMessage) (BasePolicyRu if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -224,7 +224,7 @@ func unmarshalCopyOptionClassification(rawMsg json.RawMessage) (CopyOptionClassi if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -246,7 +246,7 @@ func unmarshalDataStoreParametersClassification(rawMsg json.RawMessage) (DataSto if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -283,7 +283,7 @@ func unmarshalDeleteOptionClassification(rawMsg json.RawMessage) (DeleteOptionCl if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -301,7 +301,7 @@ func unmarshalFeatureValidationResponseBaseClassification(rawMsg json.RawMessage if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -319,7 +319,7 @@ func unmarshalItemLevelRestoreCriteriaClassification(rawMsg json.RawMessage) (It if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -364,7 +364,7 @@ func unmarshalOperationExtendedInfoClassification(rawMsg json.RawMessage) (Opera if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -382,7 +382,7 @@ func unmarshalRestoreTargetInfoBaseClassification(rawMsg json.RawMessage) (Resto if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -404,7 +404,7 @@ func unmarshalTriggerContextClassification(rawMsg json.RawMessage) (TriggerConte if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client.go index 11dcedc901a3..f0b2d666ecc8 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client.go @@ -32,9 +32,9 @@ type RecoveryPointsClient struct { } // NewRecoveryPointsClient creates a new instance of RecoveryPointsClient with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewRecoveryPointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecoveryPointsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,11 +57,12 @@ func NewRecoveryPointsClient(subscriptionID string, credential azcore.TokenCrede // Get - Gets a Recovery Point using recoveryPointId for a Datasource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// backupInstanceName - The name of the backup instance -// options - RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the backup instance. +// - options - RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. func (client *RecoveryPointsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, recoveryPointID string, options *RecoveryPointsClientGetOptions) (RecoveryPointsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, recoveryPointID, options) if err != nil { @@ -80,9 +81,6 @@ func (client *RecoveryPointsClient) Get(ctx context.Context, resourceGroupName s // getCreateRequest creates the Get request. func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, recoveryPointID string, options *RecoveryPointsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}" - 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") @@ -105,7 +103,7 @@ func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -121,11 +119,12 @@ func (client *RecoveryPointsClient) getHandleResponse(resp *http.Response) (Reco } // NewListPager - Returns a list of Recovery Points for a DataSource in a vault. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// backupInstanceName - The name of the backup instance -// options - RecoveryPointsClientListOptions contains the optional parameters for the RecoveryPointsClient.List method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the backup instance. +// - options - RecoveryPointsClientListOptions contains the optional parameters for the RecoveryPointsClient.NewListPager method. func (client *RecoveryPointsClient) NewListPager(resourceGroupName string, vaultName string, backupInstanceName string, options *RecoveryPointsClientListOptions) *runtime.Pager[RecoveryPointsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[RecoveryPointsClientListResponse]{ More: func(page RecoveryPointsClientListResponse) bool { @@ -157,9 +156,6 @@ func (client *RecoveryPointsClient) NewListPager(resourceGroupName string, vault // listCreateRequest creates the List request. func (client *RecoveryPointsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *RecoveryPointsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints" - 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") @@ -178,7 +174,7 @@ func (client *RecoveryPointsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client_example_test.go deleted file mode 100644 index f013438c1d07..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client_example_test.go +++ /dev/null @@ -1,62 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListRecoveryPoints.json -func ExampleRecoveryPointsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewRecoveryPointsClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("000pikumar", "PratikPrivatePreviewVault1", "testInstance1", &armdataprotection.RecoveryPointsClientListOptions{Filter: nil, - SkipToken: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetRecoveryPoint.json -func ExampleRecoveryPointsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewRecoveryPointsClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "000pikumar", "PratikPrivatePreviewVault1", "testInstance1", "7fb2cddd-c5b3-44f6-a0d9-db3c4f9d5f25", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client.go index f95a36fdb8aa..c8fe16b8c7cd 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client.go @@ -32,9 +32,9 @@ type ResourceGuardsClient struct { } // NewResourceGuardsClient creates a new instance of ResourceGuardsClient with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewResourceGuardsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceGuardsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,10 +57,11 @@ func NewResourceGuardsClient(subscriptionID string, credential azcore.TokenCrede // Delete - Deletes a ResourceGuard resource from the resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// resourceGuardsName - The name of ResourceGuard -// options - ResourceGuardsClientDeleteOptions contains the optional parameters for the ResourceGuardsClient.Delete method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceGuardsName - The name of ResourceGuard +// - options - ResourceGuardsClientDeleteOptions contains the optional parameters for the ResourceGuardsClient.Delete method. func (client *ResourceGuardsClient) Delete(ctx context.Context, resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientDeleteOptions) (ResourceGuardsClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceGuardsName, options) if err != nil { @@ -83,9 +84,6 @@ func (client *ResourceGuardsClient) deleteCreateRequest(ctx context.Context, res return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGuardsName == "" { return nil, errors.New("parameter resourceGuardsName cannot be empty") @@ -96,7 +94,7 @@ func (client *ResourceGuardsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -104,10 +102,11 @@ func (client *ResourceGuardsClient) deleteCreateRequest(ctx context.Context, res // Get - Returns a ResourceGuard belonging to a resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// resourceGuardsName - The name of ResourceGuard -// options - ResourceGuardsClientGetOptions contains the optional parameters for the ResourceGuardsClient.Get method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceGuardsName - The name of ResourceGuard +// - options - ResourceGuardsClientGetOptions contains the optional parameters for the ResourceGuardsClient.Get method. func (client *ResourceGuardsClient) Get(ctx context.Context, resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetOptions) (ResourceGuardsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, resourceGuardsName, options) if err != nil { @@ -130,9 +129,6 @@ func (client *ResourceGuardsClient) getCreateRequest(ctx context.Context, resour return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGuardsName == "" { return nil, errors.New("parameter resourceGuardsName cannot be empty") @@ -143,7 +139,7 @@ func (client *ResourceGuardsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -160,10 +156,11 @@ func (client *ResourceGuardsClient) getHandleResponse(resp *http.Response) (Reso // NewGetBackupSecurityPINRequestsObjectsPager - Returns collection of operation request objects for a critical operation // protected by the given ResourceGuard resource. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// options - ResourceGuardsClientGetBackupSecurityPINRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetBackupSecurityPINRequestsObjects -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ResourceGuardsClientGetBackupSecurityPINRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetBackupSecurityPINRequestsObjectsPager +// method. func (client *ResourceGuardsClient) NewGetBackupSecurityPINRequestsObjectsPager(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetBackupSecurityPINRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse] { return runtime.NewPager(runtime.PagingHandler[ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse]{ More: func(page ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse) bool { @@ -199,9 +196,6 @@ func (client *ResourceGuardsClient) getBackupSecurityPINRequestsObjectsCreateReq return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGuardsName == "" { return nil, errors.New("parameter resourceGuardsName cannot be empty") @@ -212,7 +206,7 @@ func (client *ResourceGuardsClient) getBackupSecurityPINRequestsObjectsCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -230,10 +224,11 @@ func (client *ResourceGuardsClient) getBackupSecurityPINRequestsObjectsHandleRes // GetDefaultBackupSecurityPINRequestsObject - Returns collection of operation request objects for a critical operation protected // by the given ResourceGuard resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// options - ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectOptions contains the optional parameters for the -// ResourceGuardsClient.GetDefaultBackupSecurityPINRequestsObject method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectOptions contains the optional parameters for the +// ResourceGuardsClient.GetDefaultBackupSecurityPINRequestsObject method. func (client *ResourceGuardsClient) GetDefaultBackupSecurityPINRequestsObject(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string, options *ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectOptions) (ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResponse, error) { req, err := client.getDefaultBackupSecurityPINRequestsObjectCreateRequest(ctx, resourceGroupName, resourceGuardsName, requestName, options) if err != nil { @@ -256,9 +251,6 @@ func (client *ResourceGuardsClient) getDefaultBackupSecurityPINRequestsObjectCre return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGuardsName == "" { return nil, errors.New("parameter resourceGuardsName cannot be empty") @@ -273,7 +265,7 @@ func (client *ResourceGuardsClient) getDefaultBackupSecurityPINRequestsObjectCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -291,10 +283,11 @@ func (client *ResourceGuardsClient) getDefaultBackupSecurityPINRequestsObjectHan // GetDefaultDeleteProtectedItemRequestsObject - Returns collection of operation request objects for a critical operation // protected by the given ResourceGuard resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// options - ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectOptions contains the optional parameters for the -// ResourceGuardsClient.GetDefaultDeleteProtectedItemRequestsObject method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectOptions contains the optional parameters for the +// ResourceGuardsClient.GetDefaultDeleteProtectedItemRequestsObject method. func (client *ResourceGuardsClient) GetDefaultDeleteProtectedItemRequestsObject(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string, options *ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectOptions) (ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResponse, error) { req, err := client.getDefaultDeleteProtectedItemRequestsObjectCreateRequest(ctx, resourceGroupName, resourceGuardsName, requestName, options) if err != nil { @@ -317,9 +310,6 @@ func (client *ResourceGuardsClient) getDefaultDeleteProtectedItemRequestsObjectC return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGuardsName == "" { return nil, errors.New("parameter resourceGuardsName cannot be empty") @@ -334,7 +324,7 @@ func (client *ResourceGuardsClient) getDefaultDeleteProtectedItemRequestsObjectC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -352,10 +342,11 @@ func (client *ResourceGuardsClient) getDefaultDeleteProtectedItemRequestsObjectH // GetDefaultDeleteResourceGuardProxyRequestsObject - Returns collection of operation request objects for a critical operation // protected by the given ResourceGuard resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// options - ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectOptions contains the optional parameters -// for the ResourceGuardsClient.GetDefaultDeleteResourceGuardProxyRequestsObject method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectOptions contains the optional parameters +// for the ResourceGuardsClient.GetDefaultDeleteResourceGuardProxyRequestsObject method. func (client *ResourceGuardsClient) GetDefaultDeleteResourceGuardProxyRequestsObject(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string, options *ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectOptions) (ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResponse, error) { req, err := client.getDefaultDeleteResourceGuardProxyRequestsObjectCreateRequest(ctx, resourceGroupName, resourceGuardsName, requestName, options) if err != nil { @@ -378,9 +369,6 @@ func (client *ResourceGuardsClient) getDefaultDeleteResourceGuardProxyRequestsOb return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGuardsName == "" { return nil, errors.New("parameter resourceGuardsName cannot be empty") @@ -395,7 +383,7 @@ func (client *ResourceGuardsClient) getDefaultDeleteResourceGuardProxyRequestsOb return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -413,10 +401,11 @@ func (client *ResourceGuardsClient) getDefaultDeleteResourceGuardProxyRequestsOb // GetDefaultDisableSoftDeleteRequestsObject - Returns collection of operation request objects for a critical operation protected // by the given ResourceGuard resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// options - ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectOptions contains the optional parameters for the -// ResourceGuardsClient.GetDefaultDisableSoftDeleteRequestsObject method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectOptions contains the optional parameters for the +// ResourceGuardsClient.GetDefaultDisableSoftDeleteRequestsObject method. func (client *ResourceGuardsClient) GetDefaultDisableSoftDeleteRequestsObject(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string, options *ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectOptions) (ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResponse, error) { req, err := client.getDefaultDisableSoftDeleteRequestsObjectCreateRequest(ctx, resourceGroupName, resourceGuardsName, requestName, options) if err != nil { @@ -439,9 +428,6 @@ func (client *ResourceGuardsClient) getDefaultDisableSoftDeleteRequestsObjectCre return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGuardsName == "" { return nil, errors.New("parameter resourceGuardsName cannot be empty") @@ -456,7 +442,7 @@ func (client *ResourceGuardsClient) getDefaultDisableSoftDeleteRequestsObjectCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -474,10 +460,11 @@ func (client *ResourceGuardsClient) getDefaultDisableSoftDeleteRequestsObjectHan // GetDefaultUpdateProtectedItemRequestsObject - Returns collection of operation request objects for a critical operation // protected by the given ResourceGuard resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// options - ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectOptions contains the optional parameters for the -// ResourceGuardsClient.GetDefaultUpdateProtectedItemRequestsObject method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectOptions contains the optional parameters for the +// ResourceGuardsClient.GetDefaultUpdateProtectedItemRequestsObject method. func (client *ResourceGuardsClient) GetDefaultUpdateProtectedItemRequestsObject(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string, options *ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectOptions) (ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResponse, error) { req, err := client.getDefaultUpdateProtectedItemRequestsObjectCreateRequest(ctx, resourceGroupName, resourceGuardsName, requestName, options) if err != nil { @@ -500,9 +487,6 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectedItemRequestsObjectC return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGuardsName == "" { return nil, errors.New("parameter resourceGuardsName cannot be empty") @@ -517,7 +501,7 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectedItemRequestsObjectC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -535,10 +519,11 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectedItemRequestsObjectH // GetDefaultUpdateProtectionPolicyRequestsObject - Returns collection of operation request objects for a critical operation // protected by the given ResourceGuard resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// options - ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectOptions contains the optional parameters for -// the ResourceGuardsClient.GetDefaultUpdateProtectionPolicyRequestsObject method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectOptions contains the optional parameters for +// the ResourceGuardsClient.GetDefaultUpdateProtectionPolicyRequestsObject method. func (client *ResourceGuardsClient) GetDefaultUpdateProtectionPolicyRequestsObject(ctx context.Context, resourceGroupName string, resourceGuardsName string, requestName string, options *ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectOptions) (ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse, error) { req, err := client.getDefaultUpdateProtectionPolicyRequestsObjectCreateRequest(ctx, resourceGroupName, resourceGuardsName, requestName, options) if err != nil { @@ -561,9 +546,6 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectionPolicyRequestsObje return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGuardsName == "" { return nil, errors.New("parameter resourceGuardsName cannot be empty") @@ -578,7 +560,7 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectionPolicyRequestsObje return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -595,10 +577,11 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectionPolicyRequestsObje // NewGetDeleteProtectedItemRequestsObjectsPager - Returns collection of operation request objects for a critical operation // protected by the given ResourceGuard resource. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// options - ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetDeleteProtectedItemRequestsObjects -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetDeleteProtectedItemRequestsObjectsPager +// method. func (client *ResourceGuardsClient) NewGetDeleteProtectedItemRequestsObjectsPager(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse] { return runtime.NewPager(runtime.PagingHandler[ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse]{ More: func(page ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse) bool { @@ -634,9 +617,6 @@ func (client *ResourceGuardsClient) getDeleteProtectedItemRequestsObjectsCreateR return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGuardsName == "" { return nil, errors.New("parameter resourceGuardsName cannot be empty") @@ -647,7 +627,7 @@ func (client *ResourceGuardsClient) getDeleteProtectedItemRequestsObjectsCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -664,10 +644,11 @@ func (client *ResourceGuardsClient) getDeleteProtectedItemRequestsObjectsHandleR // NewGetDeleteResourceGuardProxyRequestsObjectsPager - Returns collection of operation request objects for a critical operation // protected by the given ResourceGuard resource. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// options - ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsOptions contains the optional parameters for the -// ResourceGuardsClient.GetDeleteResourceGuardProxyRequestsObjects method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsOptions contains the optional parameters for the +// ResourceGuardsClient.NewGetDeleteResourceGuardProxyRequestsObjectsPager method. func (client *ResourceGuardsClient) NewGetDeleteResourceGuardProxyRequestsObjectsPager(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse] { return runtime.NewPager(runtime.PagingHandler[ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse]{ More: func(page ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse) bool { @@ -703,9 +684,6 @@ func (client *ResourceGuardsClient) getDeleteResourceGuardProxyRequestsObjectsCr return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGuardsName == "" { return nil, errors.New("parameter resourceGuardsName cannot be empty") @@ -716,7 +694,7 @@ func (client *ResourceGuardsClient) getDeleteResourceGuardProxyRequestsObjectsCr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -733,10 +711,11 @@ func (client *ResourceGuardsClient) getDeleteResourceGuardProxyRequestsObjectsHa // NewGetDisableSoftDeleteRequestsObjectsPager - Returns collection of operation request objects for a critical operation // protected by the given ResourceGuard resource. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// options - ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetDisableSoftDeleteRequestsObjects -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetDisableSoftDeleteRequestsObjectsPager +// method. func (client *ResourceGuardsClient) NewGetDisableSoftDeleteRequestsObjectsPager(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse] { return runtime.NewPager(runtime.PagingHandler[ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse]{ More: func(page ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse) bool { @@ -772,9 +751,6 @@ func (client *ResourceGuardsClient) getDisableSoftDeleteRequestsObjectsCreateReq return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGuardsName == "" { return nil, errors.New("parameter resourceGuardsName cannot be empty") @@ -785,7 +761,7 @@ func (client *ResourceGuardsClient) getDisableSoftDeleteRequestsObjectsCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -801,10 +777,11 @@ func (client *ResourceGuardsClient) getDisableSoftDeleteRequestsObjectsHandleRes } // NewGetResourcesInResourceGroupPager - Returns ResourceGuards collection belonging to a ResourceGroup. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// options - ResourceGuardsClientGetResourcesInResourceGroupOptions contains the optional parameters for the ResourceGuardsClient.GetResourcesInResourceGroup -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ResourceGuardsClientGetResourcesInResourceGroupOptions contains the optional parameters for the ResourceGuardsClient.NewGetResourcesInResourceGroupPager +// method. func (client *ResourceGuardsClient) NewGetResourcesInResourceGroupPager(resourceGroupName string, options *ResourceGuardsClientGetResourcesInResourceGroupOptions) *runtime.Pager[ResourceGuardsClientGetResourcesInResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[ResourceGuardsClientGetResourcesInResourceGroupResponse]{ More: func(page ResourceGuardsClientGetResourcesInResourceGroupResponse) bool { @@ -836,9 +813,6 @@ func (client *ResourceGuardsClient) NewGetResourcesInResourceGroupPager(resource // getResourcesInResourceGroupCreateRequest creates the GetResourcesInResourceGroup request. func (client *ResourceGuardsClient) getResourcesInResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ResourceGuardsClientGetResourcesInResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards" - 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") @@ -849,7 +823,7 @@ func (client *ResourceGuardsClient) getResourcesInResourceGroupCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -865,9 +839,10 @@ func (client *ResourceGuardsClient) getResourcesInResourceGroupHandleResponse(re } // NewGetResourcesInSubscriptionPager - Returns ResourceGuards collection belonging to a subscription. -// Generated from API version 2022-11-01-preview -// options - ResourceGuardsClientGetResourcesInSubscriptionOptions contains the optional parameters for the ResourceGuardsClient.GetResourcesInSubscription -// method. +// +// Generated from API version 2023-01-01 +// - options - ResourceGuardsClientGetResourcesInSubscriptionOptions contains the optional parameters for the ResourceGuardsClient.NewGetResourcesInSubscriptionPager +// method. func (client *ResourceGuardsClient) NewGetResourcesInSubscriptionPager(options *ResourceGuardsClientGetResourcesInSubscriptionOptions) *runtime.Pager[ResourceGuardsClientGetResourcesInSubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[ResourceGuardsClientGetResourcesInSubscriptionResponse]{ More: func(page ResourceGuardsClientGetResourcesInSubscriptionResponse) bool { @@ -899,16 +874,13 @@ func (client *ResourceGuardsClient) NewGetResourcesInSubscriptionPager(options * // getResourcesInSubscriptionCreateRequest creates the GetResourcesInSubscription request. func (client *ResourceGuardsClient) getResourcesInSubscriptionCreateRequest(ctx context.Context, options *ResourceGuardsClientGetResourcesInSubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -925,10 +897,11 @@ func (client *ResourceGuardsClient) getResourcesInSubscriptionHandleResponse(res // NewGetUpdateProtectedItemRequestsObjectsPager - Returns collection of operation request objects for a critical operation // protected by the given ResourceGuard resource. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// options - ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetUpdateProtectedItemRequestsObjects -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetUpdateProtectedItemRequestsObjectsPager +// method. func (client *ResourceGuardsClient) NewGetUpdateProtectedItemRequestsObjectsPager(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse] { return runtime.NewPager(runtime.PagingHandler[ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse]{ More: func(page ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse) bool { @@ -964,9 +937,6 @@ func (client *ResourceGuardsClient) getUpdateProtectedItemRequestsObjectsCreateR return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGuardsName == "" { return nil, errors.New("parameter resourceGuardsName cannot be empty") @@ -977,7 +947,7 @@ func (client *ResourceGuardsClient) getUpdateProtectedItemRequestsObjectsCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -994,10 +964,11 @@ func (client *ResourceGuardsClient) getUpdateProtectedItemRequestsObjectsHandleR // NewGetUpdateProtectionPolicyRequestsObjectsPager - Returns collection of operation request objects for a critical operation // protected by the given ResourceGuard resource. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// options - ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsOptions contains the optional parameters for the -// ResourceGuardsClient.GetUpdateProtectionPolicyRequestsObjects method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsOptions contains the optional parameters for the +// ResourceGuardsClient.NewGetUpdateProtectionPolicyRequestsObjectsPager method. func (client *ResourceGuardsClient) NewGetUpdateProtectionPolicyRequestsObjectsPager(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse] { return runtime.NewPager(runtime.PagingHandler[ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse]{ More: func(page ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse) bool { @@ -1033,9 +1004,6 @@ func (client *ResourceGuardsClient) getUpdateProtectionPolicyRequestsObjectsCrea return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGuardsName == "" { return nil, errors.New("parameter resourceGuardsName cannot be empty") @@ -1046,7 +1014,7 @@ func (client *ResourceGuardsClient) getUpdateProtectionPolicyRequestsObjectsCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1063,12 +1031,13 @@ func (client *ResourceGuardsClient) getUpdateProtectionPolicyRequestsObjectsHand // Patch - Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// resourceGuardsName - The name of ResourceGuard -// parameters - Request body for operation -// options - ResourceGuardsClientPatchOptions contains the optional parameters for the ResourceGuardsClient.Patch method. -func (client *ResourceGuardsClient) Patch(ctx context.Context, resourceGroupName string, resourceGuardsName string, parameters PatchResourceRequestInput, options *ResourceGuardsClientPatchOptions) (ResourceGuardsClientPatchResponse, error) { +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceGuardsName - The name of ResourceGuard +// - parameters - Request body for operation +// - options - ResourceGuardsClientPatchOptions contains the optional parameters for the ResourceGuardsClient.Patch method. +func (client *ResourceGuardsClient) Patch(ctx context.Context, resourceGroupName string, resourceGuardsName string, parameters PatchResourceGuardInput, options *ResourceGuardsClientPatchOptions) (ResourceGuardsClientPatchResponse, error) { req, err := client.patchCreateRequest(ctx, resourceGroupName, resourceGuardsName, parameters, options) if err != nil { return ResourceGuardsClientPatchResponse{}, err @@ -1084,15 +1053,12 @@ func (client *ResourceGuardsClient) Patch(ctx context.Context, resourceGroupName } // patchCreateRequest creates the Patch request. -func (client *ResourceGuardsClient) patchCreateRequest(ctx context.Context, resourceGroupName string, resourceGuardsName string, parameters PatchResourceRequestInput, options *ResourceGuardsClientPatchOptions) (*policy.Request, error) { +func (client *ResourceGuardsClient) patchCreateRequest(ctx context.Context, resourceGroupName string, resourceGuardsName string, parameters PatchResourceGuardInput, options *ResourceGuardsClientPatchOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGuardsName == "" { return nil, errors.New("parameter resourceGuardsName cannot be empty") @@ -1103,7 +1069,7 @@ func (client *ResourceGuardsClient) patchCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -1120,11 +1086,12 @@ func (client *ResourceGuardsClient) patchHandleResponse(resp *http.Response) (Re // Put - Creates or updates a ResourceGuard resource belonging to a resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// resourceGuardsName - The name of ResourceGuard -// parameters - Request body for operation -// options - ResourceGuardsClientPutOptions contains the optional parameters for the ResourceGuardsClient.Put method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceGuardsName - The name of ResourceGuard +// - parameters - Request body for operation +// - options - ResourceGuardsClientPutOptions contains the optional parameters for the ResourceGuardsClient.Put method. func (client *ResourceGuardsClient) Put(ctx context.Context, resourceGroupName string, resourceGuardsName string, parameters ResourceGuardResource, options *ResourceGuardsClientPutOptions) (ResourceGuardsClientPutResponse, error) { req, err := client.putCreateRequest(ctx, resourceGroupName, resourceGuardsName, parameters, options) if err != nil { @@ -1134,7 +1101,7 @@ func (client *ResourceGuardsClient) Put(ctx context.Context, resourceGroupName s if err != nil { return ResourceGuardsClientPutResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return ResourceGuardsClientPutResponse{}, runtime.NewResponseError(resp) } return client.putHandleResponse(resp) @@ -1147,9 +1114,6 @@ func (client *ResourceGuardsClient) putCreateRequest(ctx context.Context, resour return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGuardsName == "" { return nil, errors.New("parameter resourceGuardsName cannot be empty") @@ -1160,7 +1124,7 @@ func (client *ResourceGuardsClient) putCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client_example_test.go deleted file mode 100644 index 0f25f75641df..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client_example_test.go +++ /dev/null @@ -1,407 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_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/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json -func ExampleResourceGuardsClient_NewGetResourcesInSubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetResourcesInSubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json -func ExampleResourceGuardsClient_NewGetResourcesInResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetResourcesInResourceGroupPager("SampleResourceGroup", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/PutResourceGuard.json -func ExampleResourceGuardsClient_Put() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Put(ctx, "SampleResourceGroup", "swaggerExample", armdataprotection.ResourceGuardResource{ - Location: to.Ptr("WestUS"), - Tags: map[string]*string{ - "key1": to.Ptr("val1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuard.json -func ExampleResourceGuardsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "SampleResourceGroup", "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/DeleteResourceGuard.json -func ExampleResourceGuardsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "SampleResourceGroup", "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/PatchResourceGuard.json -func ExampleResourceGuardsClient_Patch() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Patch(ctx, "SampleResourceGroup", "swaggerExample", armdataprotection.PatchResourceRequestInput{ - Tags: map[string]*string{ - "newKey": to.Ptr("newVal"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json -func ExampleResourceGuardsClient_NewGetDisableSoftDeleteRequestsObjectsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetDisableSoftDeleteRequestsObjectsPager("SampleResourceGroup", "swaggerExample", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json -func ExampleResourceGuardsClient_NewGetDeleteResourceGuardProxyRequestsObjectsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetDeleteResourceGuardProxyRequestsObjectsPager("SampleResourceGroup", "swaggerExample", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json -func ExampleResourceGuardsClient_NewGetBackupSecurityPINRequestsObjectsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetBackupSecurityPINRequestsObjectsPager("SampleResourceGroup", "swaggerExample", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json -func ExampleResourceGuardsClient_NewGetDeleteProtectedItemRequestsObjectsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetDeleteProtectedItemRequestsObjectsPager("SampleResourceGroup", "swaggerExample", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json -func ExampleResourceGuardsClient_NewGetUpdateProtectionPolicyRequestsObjectsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetUpdateProtectionPolicyRequestsObjectsPager("SampleResourceGroup", "swaggerExample", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json -func ExampleResourceGuardsClient_NewGetUpdateProtectedItemRequestsObjectsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewGetUpdateProtectedItemRequestsObjectsPager("SampleResourceGroup", "swaggerExample", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json -func ExampleResourceGuardsClient_GetDefaultDisableSoftDeleteRequestsObject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetDefaultDisableSoftDeleteRequestsObject(ctx, "SampleResourceGroup", "swaggerExample", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json -func ExampleResourceGuardsClient_GetDefaultDeleteResourceGuardProxyRequestsObject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetDefaultDeleteResourceGuardProxyRequestsObject(ctx, "SampleResourceGroup", "swaggerExample", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json -func ExampleResourceGuardsClient_GetDefaultBackupSecurityPINRequestsObject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetDefaultBackupSecurityPINRequestsObject(ctx, "SampleResourceGroup", "swaggerExample", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json -func ExampleResourceGuardsClient_GetDefaultDeleteProtectedItemRequestsObject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetDefaultDeleteProtectedItemRequestsObject(ctx, "SampleResourceGroup", "swaggerExample", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json -func ExampleResourceGuardsClient_GetDefaultUpdateProtectionPolicyRequestsObject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetDefaultUpdateProtectionPolicyRequestsObject(ctx, "SampleResourceGroup", "swaggerExample", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json -func ExampleResourceGuardsClient_GetDefaultUpdateProtectedItemRequestsObject() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewResourceGuardsClient("0b352192-dcac-4cc7-992e-a96190ccc68c", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetDefaultUpdateProtectedItemRequestsObject(ctx, "SampleResourceGroup", "swaggerExample", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/response_types.go b/sdk/resourcemanager/dataprotection/armdataprotection/response_types.go index 22e7e2474470..2e55ed7bfb1a 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/response_types.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/response_types.go @@ -9,17 +9,17 @@ package armdataprotection -// BackupInstancesClientAdhocBackupResponse contains the response from method BackupInstancesClient.AdhocBackup. +// BackupInstancesClientAdhocBackupResponse contains the response from method BackupInstancesClient.BeginAdhocBackup. type BackupInstancesClientAdhocBackupResponse struct { OperationJobExtendedInfo } -// BackupInstancesClientCreateOrUpdateResponse contains the response from method BackupInstancesClient.CreateOrUpdate. +// BackupInstancesClientCreateOrUpdateResponse contains the response from method BackupInstancesClient.BeginCreateOrUpdate. type BackupInstancesClientCreateOrUpdateResponse struct { BackupInstanceResource } -// BackupInstancesClientDeleteResponse contains the response from method BackupInstancesClient.Delete. +// BackupInstancesClientDeleteResponse contains the response from method BackupInstancesClient.BeginDelete. type BackupInstancesClientDeleteResponse struct { // placeholder for future response values } @@ -34,61 +34,56 @@ type BackupInstancesClientGetResponse struct { BackupInstanceResource } -// BackupInstancesClientListResponse contains the response from method BackupInstancesClient.List. +// BackupInstancesClientListResponse contains the response from method BackupInstancesClient.NewListPager. type BackupInstancesClientListResponse struct { BackupInstanceResourceList } -// BackupInstancesClientResumeBackupsResponse contains the response from method BackupInstancesClient.ResumeBackups. +// BackupInstancesClientResumeBackupsResponse contains the response from method BackupInstancesClient.BeginResumeBackups. type BackupInstancesClientResumeBackupsResponse struct { // placeholder for future response values } -// BackupInstancesClientResumeProtectionResponse contains the response from method BackupInstancesClient.ResumeProtection. +// BackupInstancesClientResumeProtectionResponse contains the response from method BackupInstancesClient.BeginResumeProtection. type BackupInstancesClientResumeProtectionResponse struct { // placeholder for future response values } -// BackupInstancesClientStopProtectionResponse contains the response from method BackupInstancesClient.StopProtection. +// BackupInstancesClientStopProtectionResponse contains the response from method BackupInstancesClient.BeginStopProtection. type BackupInstancesClientStopProtectionResponse struct { // placeholder for future response values } -// BackupInstancesClientSuspendBackupsResponse contains the response from method BackupInstancesClient.SuspendBackups. +// BackupInstancesClientSuspendBackupsResponse contains the response from method BackupInstancesClient.BeginSuspendBackups. type BackupInstancesClientSuspendBackupsResponse struct { // placeholder for future response values } -// BackupInstancesClientSyncBackupInstanceResponse contains the response from method BackupInstancesClient.SyncBackupInstance. +// BackupInstancesClientSyncBackupInstanceResponse contains the response from method BackupInstancesClient.BeginSyncBackupInstance. type BackupInstancesClientSyncBackupInstanceResponse struct { // placeholder for future response values } -// BackupInstancesClientTriggerRehydrateResponse contains the response from method BackupInstancesClient.TriggerRehydrate. +// BackupInstancesClientTriggerRehydrateResponse contains the response from method BackupInstancesClient.BeginTriggerRehydrate. type BackupInstancesClientTriggerRehydrateResponse struct { // placeholder for future response values } -// BackupInstancesClientTriggerRestoreResponse contains the response from method BackupInstancesClient.TriggerRestore. +// BackupInstancesClientTriggerRestoreResponse contains the response from method BackupInstancesClient.BeginTriggerRestore. type BackupInstancesClientTriggerRestoreResponse struct { OperationJobExtendedInfo } -// BackupInstancesClientValidateForBackupResponse contains the response from method BackupInstancesClient.ValidateForBackup. +// BackupInstancesClientValidateForBackupResponse contains the response from method BackupInstancesClient.BeginValidateForBackup. type BackupInstancesClientValidateForBackupResponse struct { OperationJobExtendedInfo } -// BackupInstancesClientValidateForRestoreResponse contains the response from method BackupInstancesClient.ValidateForRestore. +// BackupInstancesClientValidateForRestoreResponse contains the response from method BackupInstancesClient.BeginValidateForRestore. type BackupInstancesClientValidateForRestoreResponse struct { OperationJobExtendedInfo } -// BackupInstancesExtensionRoutingClientListResponse contains the response from method BackupInstancesExtensionRoutingClient.List. -type BackupInstancesExtensionRoutingClientListResponse struct { - BackupInstanceResourceList -} - // BackupPoliciesClientCreateOrUpdateResponse contains the response from method BackupPoliciesClient.CreateOrUpdate. type BackupPoliciesClientCreateOrUpdateResponse struct { BaseBackupPolicyResource @@ -104,7 +99,7 @@ type BackupPoliciesClientGetResponse struct { BaseBackupPolicyResource } -// BackupPoliciesClientListResponse contains the response from method BackupPoliciesClient.List. +// BackupPoliciesClientListResponse contains the response from method BackupPoliciesClient.NewListPager. type BackupPoliciesClientListResponse struct { BaseBackupPolicyResourceList } @@ -127,22 +122,22 @@ type BackupVaultsClientCheckNameAvailabilityResponse struct { CheckNameAvailabilityResult } -// BackupVaultsClientCreateOrUpdateResponse contains the response from method BackupVaultsClient.CreateOrUpdate. +// BackupVaultsClientCreateOrUpdateResponse contains the response from method BackupVaultsClient.BeginCreateOrUpdate. type BackupVaultsClientCreateOrUpdateResponse struct { BackupVaultResource } -// BackupVaultsClientDeleteResponse contains the response from method BackupVaultsClient.Delete. +// BackupVaultsClientDeleteResponse contains the response from method BackupVaultsClient.BeginDelete. type BackupVaultsClientDeleteResponse struct { // placeholder for future response values } -// BackupVaultsClientGetInResourceGroupResponse contains the response from method BackupVaultsClient.GetInResourceGroup. +// BackupVaultsClientGetInResourceGroupResponse contains the response from method BackupVaultsClient.NewGetInResourceGroupPager. type BackupVaultsClientGetInResourceGroupResponse struct { BackupVaultResourceList } -// BackupVaultsClientGetInSubscriptionResponse contains the response from method BackupVaultsClient.GetInSubscription. +// BackupVaultsClientGetInSubscriptionResponse contains the response from method BackupVaultsClient.NewGetInSubscriptionPager. type BackupVaultsClientGetInSubscriptionResponse struct { BackupVaultResourceList } @@ -152,7 +147,7 @@ type BackupVaultsClientGetResponse struct { BackupVaultResource } -// BackupVaultsClientUpdateResponse contains the response from method BackupVaultsClient.Update. +// BackupVaultsClientUpdateResponse contains the response from method BackupVaultsClient.BeginUpdate. type BackupVaultsClientUpdateResponse struct { BackupVaultResource } @@ -177,42 +172,17 @@ type DeletedBackupInstancesClientGetResponse struct { DeletedBackupInstanceResource } -// DeletedBackupInstancesClientListResponse contains the response from method DeletedBackupInstancesClient.List. +// DeletedBackupInstancesClientListResponse contains the response from method DeletedBackupInstancesClient.NewListPager. type DeletedBackupInstancesClientListResponse struct { DeletedBackupInstanceResourceList } -// DeletedBackupInstancesClientUndeleteResponse contains the response from method DeletedBackupInstancesClient.Undelete. +// DeletedBackupInstancesClientUndeleteResponse contains the response from method DeletedBackupInstancesClient.BeginUndelete. type DeletedBackupInstancesClientUndeleteResponse struct { // placeholder for future response values } -// DppResourceGuardProxyClientDeleteResponse contains the response from method DppResourceGuardProxyClient.Delete. -type DppResourceGuardProxyClientDeleteResponse struct { - // placeholder for future response values -} - -// DppResourceGuardProxyClientGetResponse contains the response from method DppResourceGuardProxyClient.Get. -type DppResourceGuardProxyClientGetResponse struct { - ResourceGuardProxyBaseResource -} - -// DppResourceGuardProxyClientListResponse contains the response from method DppResourceGuardProxyClient.List. -type DppResourceGuardProxyClientListResponse struct { - ResourceGuardProxyBaseResourceList -} - -// DppResourceGuardProxyClientPutResponse contains the response from method DppResourceGuardProxyClient.Put. -type DppResourceGuardProxyClientPutResponse struct { - ResourceGuardProxyBaseResource -} - -// DppResourceGuardProxyClientUnlockDeleteResponse contains the response from method DppResourceGuardProxyClient.UnlockDelete. -type DppResourceGuardProxyClientUnlockDeleteResponse struct { - UnlockDeleteResponse -} - -// ExportJobsClientTriggerResponse contains the response from method ExportJobsClient.Trigger. +// ExportJobsClientTriggerResponse contains the response from method ExportJobsClient.BeginTrigger. type ExportJobsClientTriggerResponse struct { // placeholder for future response values } @@ -227,7 +197,7 @@ type JobsClientGetResponse struct { AzureBackupJobResource } -// JobsClientListResponse contains the response from method JobsClient.List. +// JobsClientListResponse contains the response from method JobsClient.NewListPager. type JobsClientListResponse struct { AzureBackupJobResourceList } @@ -260,7 +230,7 @@ type OperationStatusResourceGroupContextClientGetResponse struct { OperationResource } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { ClientDiscoveryResponse } @@ -270,7 +240,7 @@ type RecoveryPointsClientGetResponse struct { AzureBackupRecoveryPointResource } -// RecoveryPointsClientListResponse contains the response from method RecoveryPointsClient.List. +// RecoveryPointsClientListResponse contains the response from method RecoveryPointsClient.NewListPager. type RecoveryPointsClientListResponse struct { AzureBackupRecoveryPointResourceList } @@ -280,7 +250,7 @@ type ResourceGuardsClientDeleteResponse struct { // placeholder for future response values } -// ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse contains the response from method ResourceGuardsClient.GetBackupSecurityPINRequestsObjects. +// ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse contains the response from method ResourceGuardsClient.NewGetBackupSecurityPINRequestsObjectsPager. type ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse struct { DppBaseResourceList } @@ -315,27 +285,27 @@ type ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse DppBaseResource } -// ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse contains the response from method ResourceGuardsClient.GetDeleteProtectedItemRequestsObjects. +// ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse contains the response from method ResourceGuardsClient.NewGetDeleteProtectedItemRequestsObjectsPager. type ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse struct { DppBaseResourceList } -// ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse contains the response from method ResourceGuardsClient.GetDeleteResourceGuardProxyRequestsObjects. +// ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse contains the response from method ResourceGuardsClient.NewGetDeleteResourceGuardProxyRequestsObjectsPager. type ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse struct { DppBaseResourceList } -// ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse contains the response from method ResourceGuardsClient.GetDisableSoftDeleteRequestsObjects. +// ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse contains the response from method ResourceGuardsClient.NewGetDisableSoftDeleteRequestsObjectsPager. type ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse struct { DppBaseResourceList } -// ResourceGuardsClientGetResourcesInResourceGroupResponse contains the response from method ResourceGuardsClient.GetResourcesInResourceGroup. +// ResourceGuardsClientGetResourcesInResourceGroupResponse contains the response from method ResourceGuardsClient.NewGetResourcesInResourceGroupPager. type ResourceGuardsClientGetResourcesInResourceGroupResponse struct { ResourceGuardResourceList } -// ResourceGuardsClientGetResourcesInSubscriptionResponse contains the response from method ResourceGuardsClient.GetResourcesInSubscription. +// ResourceGuardsClientGetResourcesInSubscriptionResponse contains the response from method ResourceGuardsClient.NewGetResourcesInSubscriptionPager. type ResourceGuardsClientGetResourcesInSubscriptionResponse struct { ResourceGuardResourceList } @@ -345,12 +315,12 @@ type ResourceGuardsClientGetResponse struct { ResourceGuardResource } -// ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse contains the response from method ResourceGuardsClient.GetUpdateProtectedItemRequestsObjects. +// ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse contains the response from method ResourceGuardsClient.NewGetUpdateProtectedItemRequestsObjectsPager. type ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse struct { DppBaseResourceList } -// ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse contains the response from method ResourceGuardsClient.GetUpdateProtectionPolicyRequestsObjects. +// ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse contains the response from method ResourceGuardsClient.NewGetUpdateProtectionPolicyRequestsObjectsPager. type ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse struct { DppBaseResourceList } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client.go index 6681f48ffcbf..8c24e35e9f57 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client.go @@ -32,9 +32,9 @@ type RestorableTimeRangesClient struct { } // NewRestorableTimeRangesClient creates a new instance of RestorableTimeRangesClient with the specified values. -// subscriptionID - The subscription Id. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewRestorableTimeRangesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RestorableTimeRangesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,13 +57,14 @@ func NewRestorableTimeRangesClient(subscriptionID string, credential azcore.Toke // Find - // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-11-01-preview -// resourceGroupName - The name of the resource group where the backup vault is present. -// vaultName - The name of the backup vault. -// backupInstanceName - The name of the backup instance -// parameters - Request body for operation -// options - RestorableTimeRangesClientFindOptions contains the optional parameters for the RestorableTimeRangesClient.Find -// method. +// +// Generated from API version 2023-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The name of the backup vault. +// - backupInstanceName - The name of the backup instance. +// - parameters - Request body for operation +// - options - RestorableTimeRangesClientFindOptions contains the optional parameters for the RestorableTimeRangesClient.Find +// method. func (client *RestorableTimeRangesClient) Find(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupFindRestorableTimeRangesRequest, options *RestorableTimeRangesClientFindOptions) (RestorableTimeRangesClientFindResponse, error) { req, err := client.findCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { @@ -82,9 +83,6 @@ func (client *RestorableTimeRangesClient) Find(ctx context.Context, resourceGrou // findCreateRequest creates the Find request. func (client *RestorableTimeRangesClient) findCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupFindRestorableTimeRangesRequest, options *RestorableTimeRangesClientFindOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/findRestorableTimeRanges" - 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") @@ -103,7 +101,7 @@ func (client *RestorableTimeRangesClient) findCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-11-01-preview") + reqQP.Set("api-version", "2023-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client_example_test.go deleted file mode 100644 index 2105cacf28ba..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client_example_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armdataprotection_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/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/FindRestorableTimeRanges.json -func ExampleRestorableTimeRangesClient_Find() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armdataprotection.NewRestorableTimeRangesClient("04cf684a-d41f-4550-9f70-7708a3a2283b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Find(ctx, "Blob-Backup", "ZBlobBackupVaultBVTD3", "zblobbackuptestsa58", armdataprotection.AzureBackupFindRestorableTimeRangesRequest{ - EndTime: to.Ptr("2021-02-24T00:35:17.6829685Z"), - SourceDataStoreType: to.Ptr(armdataprotection.RestoreSourceDataStoreTypeOperationalStore), - StartTime: to.Ptr("2020-10-17T23:28:17.6829685Z"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/time_rfc3339.go b/sdk/resourcemanager/dataprotection/armdataprotection/time_rfc3339.go index c98824f86dfa..8ee2848040f9 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/time_rfc3339.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/time_rfc3339.go @@ -62,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) {