diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md b/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md index dac76a270316..74534e8d84ef 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md +++ b/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md @@ -1,5 +1,50 @@ # Release History +## 2.0.0 (2022-12-19) +### Breaking Changes + +- Function `*ResourceGuardsClient.Patch` parameter(s) have been changed from `(context.Context, string, string, PatchResourceRequestInput, *ResourceGuardsClientPatchOptions)` to `(context.Context, string, string, PatchResourceGuardInput, *ResourceGuardsClientPatchOptions)` +- Const `StorageSettingStoreTypesSnapshotStore` has been removed +- 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 `ImmutabilityState` with values `ImmutabilityStateDisabled`, `ImmutabilityStateLocked`, `ImmutabilityStateUnlocked` +- New type alias `SoftDeleteState` with values `SoftDeleteStateAlwaysOn`, `SoftDeleteStateOff`, `SoftDeleteStateOn` +- 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 struct `CrossSubscriptionRestoreSettings` +- New struct `DeletedBackupInstance` +- New struct `DeletedBackupInstanceResource` +- New struct `DeletedBackupInstanceResourceList` +- New struct `DeletedBackupInstancesClient` +- New struct `DeletedBackupInstancesClientListResponse` +- New struct `DeletedBackupInstancesClientUndeleteResponse` +- New struct `DeletionInfo` +- New struct `DppBaseTrackedResource` +- New struct `DppProxyResource` +- New struct `FeatureSettings` +- New struct `ImmutabilitySettings` +- New struct `PatchResourceGuardInput` +- New struct `SecuritySettings` +- New struct `SoftDeleteSettings` +- 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 `TargetResourceArmID` in struct `TargetDetails` + + ## 1.0.0 (2022-05-18) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/autorest.md b/sdk/resourcemanager/dataprotection/armdataprotection/autorest.md index a9605a879795..a993cfb810d0 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/autorest.md +++ b/sdk/resourcemanager/dataprotection/armdataprotection/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/dataprotection/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/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: 1.0.0 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupinstances_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client.go similarity index 90% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupinstances_client.go rename to sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client.go index 85f2dfcf4ab9..e734c0add904 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupinstances_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client.go @@ -5,6 +5,7 @@ // 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 @@ -31,7 +32,7 @@ type BackupInstancesClient struct { } // NewBackupInstancesClient creates a new instance of BackupInstancesClient with the specified values. -// subscriptionID - The subscription Id. +// 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) { @@ -56,10 +57,10 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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 +// backupInstanceName - The name of the backup instance. // parameters - Request body for operation // options - BackupInstancesClientBeginAdhocBackupOptions contains the optional parameters for the BackupInstancesClient.BeginAdhocBackup // method. @@ -77,7 +78,7 @@ 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-04-01 +// Generated from API version 2022-12-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 { @@ -96,9 +97,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") @@ -117,7 +115,7 @@ func (client *BackupInstancesClient) adhocBackupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -125,10 +123,10 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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 +// backupInstanceName - The name of the backup instance. // parameters - Request body for operation // options - BackupInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupInstancesClient.BeginCreateOrUpdate // method. @@ -146,7 +144,7 @@ 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-04-01 +// Generated from API version 2022-12-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 { @@ -165,9 +163,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") @@ -186,7 +181,7 @@ func (client *BackupInstancesClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -194,10 +189,10 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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 +// 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) { @@ -214,7 +209,7 @@ 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-04-01 +// Generated from API version 2022-12-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 { @@ -233,9 +228,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") @@ -254,7 +246,7 @@ func (client *BackupInstancesClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -262,10 +254,10 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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 +// 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) @@ -285,9 +277,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") @@ -306,7 +295,7 @@ func (client *BackupInstancesClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -323,9 +312,10 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -346,9 +336,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") @@ -371,7 +358,7 @@ func (client *BackupInstancesClient) getBackupInstanceOperationResultCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -387,9 +374,8 @@ func (client *BackupInstancesClient) getBackupInstanceOperationResultHandleRespo } // NewListPager - Gets a backup instances belonging to a backup vault -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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.List method. func (client *BackupInstancesClient) NewListPager(resourceGroupName string, vaultName string, options *BackupInstancesClientListOptions) *runtime.Pager[BackupInstancesClientListResponse] { @@ -423,9 +409,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 +423,7 @@ func (client *BackupInstancesClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -457,9 +440,10 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -476,7 +460,7 @@ 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-04-01 +// Generated from API version 2022-12-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 +479,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 +497,7 @@ func (client *BackupInstancesClient) resumeBackupsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -524,9 +505,10 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -543,7 +525,7 @@ 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-04-01 +// Generated from API version 2022-12-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 +544,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 +562,7 @@ func (client *BackupInstancesClient) resumeProtectionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -591,9 +570,10 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -610,7 +590,7 @@ 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-04-01 +// Generated from API version 2022-12-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 +609,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,17 +627,19 @@ func (client *BackupInstancesClient) stopProtectionCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// BeginSuspendBackups - This operation will stop backups for backup instance +// 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -675,9 +654,10 @@ func (client *BackupInstancesClient) BeginSuspendBackups(ctx context.Context, re } } -// SuspendBackups - This operation will stop backups for backup instance +// 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-04-01 +// Generated from API version 2022-12-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 { @@ -696,9 +676,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") @@ -717,7 +694,7 @@ func (client *BackupInstancesClient) suspendBackupsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -726,9 +703,10 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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. @@ -747,7 +725,7 @@ 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-04-01 +// Generated from API version 2022-12-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 { @@ -766,9 +744,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") @@ -787,7 +762,7 @@ func (client *BackupInstancesClient) syncBackupInstanceCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -795,9 +770,10 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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. @@ -815,7 +791,7 @@ 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-04-01 +// Generated from API version 2022-12-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 { @@ -838,9 +814,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") @@ -855,7 +828,7 @@ func (client *BackupInstancesClient) triggerRehydrateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -863,10 +836,10 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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 +// backupInstanceName - The name of the backup instance. // parameters - Request body for operation // options - BackupInstancesClientBeginTriggerRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginTriggerRestore // method. @@ -884,7 +857,7 @@ 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-04-01 +// Generated from API version 2022-12-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 { @@ -903,9 +876,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") @@ -924,7 +894,7 @@ func (client *BackupInstancesClient) triggerRestoreCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -932,8 +902,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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 @@ -952,7 +922,7 @@ 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-04-01 +// Generated from API version 2022-12-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 { @@ -971,9 +941,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") @@ -988,7 +955,7 @@ func (client *BackupInstancesClient) validateForBackupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -996,10 +963,10 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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 +// backupInstanceName - The name of the backup instance. // parameters - Request body for operation // options - BackupInstancesClientBeginValidateForRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginValidateForRestore // method. @@ -1017,7 +984,7 @@ 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-04-01 +// Generated from API version 2022-12-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 { @@ -1036,9 +1003,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") @@ -1057,7 +1021,7 @@ func (client *BackupInstancesClient) validateForRestoreCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-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/zz_generated_backuppolicies_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client.go similarity index 91% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backuppolicies_client.go rename to sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client.go index 025bd98fd83c..03dbaf20723b 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backuppolicies_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client.go @@ -5,6 +5,7 @@ // 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 @@ -31,7 +32,7 @@ type BackupPoliciesClient struct { } // NewBackupPoliciesClient creates a new instance of BackupPoliciesClient with the specified values. -// subscriptionID - The subscription Id. +// 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) { @@ -56,8 +57,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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 @@ -81,9 +82,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") @@ -102,7 +100,7 @@ func (client *BackupPoliciesClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -119,8 +117,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -141,9 +139,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") @@ -162,7 +157,7 @@ func (client *BackupPoliciesClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -170,8 +165,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -192,9 +187,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") @@ -213,7 +205,7 @@ func (client *BackupPoliciesClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -229,9 +221,8 @@ func (client *BackupPoliciesClient) getHandleResponse(resp *http.Response) (Back } // NewListPager - Returns list of backup policies belonging to a backup vault -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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.List method. func (client *BackupPoliciesClient) NewListPager(resourceGroupName string, vaultName string, options *BackupPoliciesClientListOptions) *runtime.Pager[BackupPoliciesClientListResponse] { @@ -265,9 +256,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 +270,7 @@ func (client *BackupPoliciesClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupvaultoperationresults_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client.go similarity index 94% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupvaultoperationresults_client.go rename to sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client.go index 72065f20d470..6c937d542347 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupvaultoperationresults_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client.go @@ -5,6 +5,7 @@ // 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 @@ -32,7 +33,7 @@ type BackupVaultOperationResultsClient struct { } // NewBackupVaultOperationResultsClient creates a new instance of BackupVaultOperationResultsClient with the specified values. -// subscriptionID - The subscription Id. +// 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) { @@ -57,8 +58,8 @@ func NewBackupVaultOperationResultsClient(subscriptionID string, credential azco // Get - // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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. @@ -80,9 +81,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") @@ -101,7 +99,7 @@ func (client *BackupVaultOperationResultsClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupvaults_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client.go similarity index 90% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupvaults_client.go rename to sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client.go index ff021022f85a..92023e2e4abd 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_backupvaults_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client.go @@ -5,6 +5,7 @@ // 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 @@ -31,7 +32,7 @@ type BackupVaultsClient struct { } // NewBackupVaultsClient creates a new instance of BackupVaultsClient with the specified values. -// subscriptionID - The subscription Id. +// 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) { @@ -56,8 +57,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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 @@ -84,9 +85,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") @@ -97,7 +95,7 @@ func (client *BackupVaultsClient) checkNameAvailabilityCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -114,8 +112,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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 @@ -134,7 +132,7 @@ 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-04-01 +// Generated from API version 2022-12-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 { @@ -153,9 +151,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") @@ -170,7 +165,7 @@ func (client *BackupVaultsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -178,8 +173,8 @@ func (client *BackupVaultsClient) createOrUpdateCreateRequest(ctx context.Contex // Delete - Deletes a BackupVault resource from the resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. // 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) { @@ -200,9 +195,6 @@ func (client *BackupVaultsClient) Delete(ctx context.Context, resourceGroupName // deleteCreateRequest creates the Delete request. func (client *BackupVaultsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *BackupVaultsClientDeleteOptions) (*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") @@ -217,7 +209,7 @@ func (client *BackupVaultsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -225,8 +217,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -247,9 +239,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") @@ -264,7 +253,7 @@ func (client *BackupVaultsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,9 +269,8 @@ func (client *BackupVaultsClient) getHandleResponse(resp *http.Response) (Backup } // NewGetInResourceGroupPager - Returns resource collection belonging to a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. // options - BackupVaultsClientGetInResourceGroupOptions contains the optional parameters for the BackupVaultsClient.GetInResourceGroup // method. func (client *BackupVaultsClient) NewGetInResourceGroupPager(resourceGroupName string, options *BackupVaultsClientGetInResourceGroupOptions) *runtime.Pager[BackupVaultsClientGetInResourceGroupResponse] { @@ -320,16 +308,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-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -345,8 +330,7 @@ func (client *BackupVaultsClient) getInResourceGroupHandleResponse(resp *http.Re } // NewGetInSubscriptionPager - Returns resource collection belonging to a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 +// Generated from API version 2022-12-01 // options - BackupVaultsClientGetInSubscriptionOptions contains the optional parameters for the BackupVaultsClient.GetInSubscription // method. func (client *BackupVaultsClient) NewGetInSubscriptionPager(options *BackupVaultsClientGetInSubscriptionOptions) *runtime.Pager[BackupVaultsClientGetInSubscriptionResponse] { @@ -380,16 +364,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-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -406,8 +387,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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 @@ -426,7 +407,7 @@ 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-04-01 +// Generated from API version 2022-12-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 { @@ -445,9 +426,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") @@ -462,7 +440,7 @@ func (client *BackupVaultsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-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/zz_generated_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/client.go similarity index 94% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_client.go rename to sdk/resourcemanager/dataprotection/armdataprotection/client.go index ba789f400e98..56c0571c7042 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/client.go @@ -5,6 +5,7 @@ // 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 @@ -31,7 +32,7 @@ type Client struct { } // NewClient creates a new instance of Client with the specified values. -// subscriptionID - The subscription Id. +// 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) { @@ -56,7 +57,7 @@ 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-04-01 +// Generated from API version 2022-12-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) { @@ -77,9 +78,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") @@ -90,7 +88,7 @@ func (client *Client) checkFeatureSupportCreateRequest(ctx context.Context, loca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-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/zz_generated_constants.go b/sdk/resourcemanager/dataprotection/armdataprotection/constants.go similarity index 85% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_constants.go rename to sdk/resourcemanager/dataprotection/armdataprotection/constants.go index 3c3ac7bf0667..f26e97f38223 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_constants.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/constants.go @@ -5,12 +5,13 @@ // 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 const ( moduleName = "armdataprotection" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) type AbsoluteMarker string @@ -69,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 @@ -188,6 +207,24 @@ func PossibleFeatureTypeValues() []FeatureType { } } +// ImmutabilityState - Immutability state +type ImmutabilityState string + +const ( + ImmutabilityStateDisabled ImmutabilityState = "Disabled" + ImmutabilityStateLocked ImmutabilityState = "Locked" + ImmutabilityStateUnlocked ImmutabilityState = "Unlocked" +) + +// PossibleImmutabilityStateValues returns the possible values for the ImmutabilityState const type. +func PossibleImmutabilityStateValues() []ImmutabilityState { + return []ImmutabilityState{ + ImmutabilityStateDisabled, + ImmutabilityStateLocked, + ImmutabilityStateUnlocked, + } +} + type Month string const ( @@ -382,19 +419,42 @@ func PossibleSecretStoreTypeValues() []SecretStoreType { } } +// SoftDeleteState - State of soft delete +type SoftDeleteState string + +const ( + // SoftDeleteStateAlwaysOn - Soft Delete is permanently enabled for the BackupVault and the setting cannot be changed + SoftDeleteStateAlwaysOn SoftDeleteState = "AlwaysOn" + // SoftDeleteStateOff - Soft Delete is turned off for the BackupVault + SoftDeleteStateOff SoftDeleteState = "Off" + // SoftDeleteStateOn - Soft Delete is enabled for the BackupVault but can be turned off + SoftDeleteStateOn SoftDeleteState = "On" +) + +// PossibleSoftDeleteStateValues returns the possible values for the SoftDeleteState const type. +func PossibleSoftDeleteStateValues() []SoftDeleteState { + return []SoftDeleteState{ + SoftDeleteStateAlwaysOn, + SoftDeleteStateOff, + SoftDeleteStateOn, + } +} + // SourceDataStoreType - Gets or sets the type of the source data store. 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, } @@ -428,16 +488,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, } } @@ -448,6 +508,7 @@ type StorageSettingTypes string const ( StorageSettingTypesGeoRedundant StorageSettingTypes = "GeoRedundant" StorageSettingTypesLocallyRedundant StorageSettingTypes = "LocallyRedundant" + StorageSettingTypesZoneRedundant StorageSettingTypes = "ZoneRedundant" ) // PossibleStorageSettingTypesValues returns the possible values for the StorageSettingTypes const type. @@ -455,6 +516,7 @@ func PossibleStorageSettingTypesValues() []StorageSettingTypes { return []StorageSettingTypes{ StorageSettingTypesGeoRedundant, StorageSettingTypesLocallyRedundant, + StorageSettingTypesZoneRedundant, } } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client.go new file mode 100644 index 000000000000..fdd19592942b --- /dev/null +++ b/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client.go @@ -0,0 +1,246 @@ +//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" +) + +// DeletedBackupInstancesClient contains the methods for the DeletedBackupInstances group. +// Don't use this type directly, use NewDeletedBackupInstancesClient() instead. +type DeletedBackupInstancesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDeletedBackupInstancesClient creates a new instance of DeletedBackupInstancesClient with the specified values. +// subscriptionID - The ID of the target subscription. The value must be an UUID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDeletedBackupInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeletedBackupInstancesClient, 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 := &DeletedBackupInstancesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// 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-12-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 { + return DeletedBackupInstancesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeletedBackupInstancesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeletedBackupInstancesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// 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}" + 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 backupInstanceName == "" { + return nil, errors.New("parameter backupInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupInstanceName}", url.PathEscape(backupInstanceName)) + 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-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DeletedBackupInstancesClient) getHandleResponse(resp *http.Response) (DeletedBackupInstancesClientGetResponse, error) { + result := DeletedBackupInstancesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeletedBackupInstanceResource); err != nil { + return DeletedBackupInstancesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets deleted backup instances belonging to a backup vault +// Generated from API version 2022-12-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.List +// 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 { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DeletedBackupInstancesClientListResponse) (DeletedBackupInstancesClientListResponse, 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 DeletedBackupInstancesClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DeletedBackupInstancesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DeletedBackupInstancesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// 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" + 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-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *DeletedBackupInstancesClient) listHandleResponse(resp *http.Response) (DeletedBackupInstancesClientListResponse, error) { + result := DeletedBackupInstancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeletedBackupInstanceResourceList); err != nil { + return DeletedBackupInstancesClientListResponse{}, err + } + return result, nil +} + +// BeginUndelete - +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-12-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) + if err != nil { + return nil, err + } + return runtime.NewPoller[DeletedBackupInstancesClientUndeleteResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[DeletedBackupInstancesClientUndeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Undelete - +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-12-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 { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// 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" + 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 backupInstanceName == "" { + return nil, errors.New("parameter backupInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backupInstanceName}", url.PathEscape(backupInstanceName)) + 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-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_exportjobs_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client.go similarity index 92% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_exportjobs_client.go rename to sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client.go index bc8fbaf601f6..a054e5af4ec8 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_exportjobs_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client.go @@ -5,6 +5,7 @@ // 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 @@ -31,7 +32,7 @@ type ExportJobsClient struct { } // NewExportJobsClient creates a new instance of ExportJobsClient with the specified values. -// subscriptionID - The subscription Id. +// 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) { @@ -56,8 +57,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -76,7 +77,7 @@ 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-04-01 +// Generated from API version 2022-12-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 { @@ -95,9 +96,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") @@ -112,7 +110,7 @@ func (client *ExportJobsClient) triggerCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_exportjobsoperationresult_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client.go similarity index 94% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_exportjobsoperationresult_client.go rename to sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client.go index 4ee9411b970a..b54abd257e4e 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_exportjobsoperationresult_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client.go @@ -5,6 +5,7 @@ // 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 @@ -31,7 +32,7 @@ type ExportJobsOperationResultClient struct { } // NewExportJobsOperationResultClient creates a new instance of ExportJobsOperationResultClient with the specified values. -// subscriptionID - The subscription Id. +// 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) { @@ -58,8 +59,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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 @@ -82,9 +83,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") @@ -103,7 +101,7 @@ func (client *ExportJobsOperationResultClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/go.mod b/sdk/resourcemanager/dataprotection/armdataprotection/go.mod index 483704c7eac6..9353aa998d30 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/go.mod +++ b/sdk/resourcemanager/dataprotection/armdataprotection/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +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.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/go.sum b/sdk/resourcemanager/dataprotection/armdataprotection/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/go.sum +++ b/sdk/resourcemanager/dataprotection/armdataprotection/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= 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.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_jobs_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/jobs_client.go similarity index 91% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_jobs_client.go rename to sdk/resourcemanager/dataprotection/armdataprotection/jobs_client.go index c76171abb151..0e01b4d2d5bc 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_jobs_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/jobs_client.go @@ -5,6 +5,7 @@ // 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 @@ -31,7 +32,7 @@ type JobsClient struct { } // NewJobsClient creates a new instance of JobsClient with the specified values. -// subscriptionID - The subscription Id. +// 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) { @@ -56,8 +57,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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. @@ -79,9 +80,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") @@ -100,7 +98,7 @@ func (client *JobsClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -116,9 +114,8 @@ func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsClientGetR } // NewListPager - Returns list of jobs belonging to a backup vault -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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.List method. func (client *JobsClient) NewListPager(resourceGroupName string, vaultName string, options *JobsClientListOptions) *runtime.Pager[JobsClientListResponse] { @@ -152,9 +149,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 +163,7 @@ func (client *JobsClient) listCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_models.go b/sdk/resourcemanager/dataprotection/armdataprotection/models.go similarity index 92% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_models.go rename to sdk/resourcemanager/dataprotection/armdataprotection/models.go index 9584d172e8e5..106dc3996bd5 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_models.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/models.go @@ -5,6 +5,7 @@ // 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 @@ -96,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. @@ -626,16 +630,19 @@ type BackupInstanceResource struct { // BackupInstanceResource properties Properties *BackupInstance `json:"properties,omitempty"` - // READ-ONLY; Resource Id represents the complete path to the resource. + // Proxy Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Proxy Resource Id represents the complete path to the resource. ID *string `json:"id,omitempty" azure:"ro"` - // READ-ONLY; Resource name associated with the resource. + // READ-ONLY; Proxy 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/… + // READ-ONLY; Proxy Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… Type *string `json:"type,omitempty" azure:"ro"` } @@ -820,9 +827,18 @@ 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"` + // Security Settings + SecuritySettings *SecuritySettings `json:"securitySettings,omitempty"` + + // READ-ONLY; Is vault protected by resource guard + IsVaultProtectedByResourceGuard *bool `json:"isVaultProtectedByResourceGuard,omitempty" azure:"ro"` + // READ-ONLY; Provisioning state of the BackupVault resource ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` @@ -1080,12 +1096,6 @@ type ClientDiscoveryValueForSingleAPI struct { Properties *ClientDiscoveryForProperties `json:"properties,omitempty"` } -// CloudError - An error response from Azure Backup. -type CloudError struct { - // The resource management error response. - Error *Error `json:"error,omitempty"` -} - // CopyOnExpiryOption - Copy on Expiry Option type CopyOnExpiryOption struct { // REQUIRED; Type of the specific object - used for deserializing @@ -1117,6 +1127,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 @@ -1243,6 +1259,104 @@ type DeleteOption struct { // GetDeleteOption implements the DeleteOptionClassification interface for type DeleteOption. func (d *DeleteOption) GetDeleteOption() *DeleteOption { return d } +// DeletedBackupInstance - Deleted Backup Instance +type DeletedBackupInstance struct { + // REQUIRED; Gets or sets the data source information. + DataSourceInfo *Datasource `json:"dataSourceInfo,omitempty"` + + // REQUIRED + ObjectType *string `json:"objectType,omitempty"` + + // REQUIRED; Gets or sets the policy information. + PolicyInfo *PolicyInfo `json:"policyInfo,omitempty"` + + // Gets or sets the data source set information. + DataSourceSetInfo *DatasourceSet `json:"dataSourceSetInfo,omitempty"` + + // Credentials to use to authenticate with data source provider. + DatasourceAuthCredentials AuthCredentialsClassification `json:"datasourceAuthCredentials,omitempty"` + + // Gets or sets the Backup Instance friendly name. + FriendlyName *string `json:"friendlyName,omitempty"` + + // Specifies the type of validation. In case of DeepValidation, all validations from /validateForBackup API will run again. + ValidationType *ValidationType `json:"validationType,omitempty"` + + // READ-ONLY; Specifies the current protection state of the resource + CurrentProtectionState *CurrentProtectionState `json:"currentProtectionState,omitempty" azure:"ro"` + + // READ-ONLY; Deletion info of Backup Instance + DeletionInfo *DeletionInfo `json:"deletionInfo,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the protection error of the resource + ProtectionErrorDetails *UserFacingError `json:"protectionErrorDetails,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the protection status of the resource + ProtectionStatus *ProtectionStatusDetails `json:"protectionStatus,omitempty" azure:"ro"` + + // READ-ONLY; Specifies the provisioning state of the resource i.e. provisioning/updating/Succeeded/Failed + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` +} + +// DeletedBackupInstanceResource - Deleted Backup Instance +type DeletedBackupInstanceResource struct { + // DeletedBackupInstanceResource properties + Properties *DeletedBackupInstance `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"` +} + +// DeletedBackupInstanceResourceList - List of DeletedBackupInstance resources +type DeletedBackupInstanceResourceList 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 []*DeletedBackupInstanceResource `json:"value,omitempty"` +} + +// DeletedBackupInstancesClientBeginUndeleteOptions contains the optional parameters for the DeletedBackupInstancesClient.BeginUndelete +// method. +type DeletedBackupInstancesClientBeginUndeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DeletedBackupInstancesClientGetOptions contains the optional parameters for the DeletedBackupInstancesClient.Get method. +type DeletedBackupInstancesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DeletedBackupInstancesClientListOptions contains the optional parameters for the DeletedBackupInstancesClient.List method. +type DeletedBackupInstancesClientListOptions struct { + // placeholder for future optional parameters +} + +// DeletionInfo - Deletion Info +type DeletionInfo struct { + // READ-ONLY; Specifies billing end date + BillingEndDate *string `json:"billingEndDate,omitempty" azure:"ro"` + + // READ-ONLY; Delete activity ID for troubleshooting purpose + DeleteActivityID *string `json:"deleteActivityID,omitempty" azure:"ro"` + + // READ-ONLY; Specifies time of deletion + DeletionTime *string `json:"deletionTime,omitempty" azure:"ro"` + + // READ-ONLY; Specifies purge time + ScheduledPurgeTime *string `json:"scheduledPurgeTime,omitempty" azure:"ro"` +} + // DppBaseResource - Base resource under Microsoft.DataProtection provider namespace type DppBaseResource struct { // READ-ONLY; Resource Id represents the complete path to the resource. @@ -1264,6 +1378,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 @@ -1277,6 +1414,23 @@ type DppIdentityDetails struct { TenantID *string `json:"tenantId,omitempty" azure:"ro"` } +type DppProxyResource struct { + // Proxy Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Proxy Resource Id represents the complete path to the resource. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Proxy 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; Proxy Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/… + Type *string `json:"type,omitempty" azure:"ro"` +} + // DppResource - Resource class type DppResource struct { // READ-ONLY; Resource Id represents the complete path to the resource. @@ -1397,6 +1551,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 @@ -1488,6 +1648,12 @@ func (i *ImmediateCopyOption) GetCopyOption() *CopyOption { } } +// ImmutabilitySettings - Immutability Settings at vault level +type ImmutabilitySettings struct { + // Immutability state + State *ImmutabilityState `json:"state,omitempty"` +} + // InnerError - Inner Error type InnerError struct { // Any Key value pairs that can be provided to the client for additional verbose information. @@ -1734,8 +1900,20 @@ type OperationsClientListOptions struct { // 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"` + + // Security Settings + 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 @@ -1865,9 +2043,6 @@ 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"` @@ -2209,6 +2384,24 @@ type SecretStoreResource struct { Value *string `json:"value,omitempty"` } +// SecuritySettings - Class containing security settings of vault +type SecuritySettings struct { + // Immutability Settings at vault level + ImmutabilitySettings *ImmutabilitySettings `json:"immutabilitySettings,omitempty"` + + // Soft delete related settings + SoftDeleteSettings *SoftDeleteSettings `json:"softDeleteSettings,omitempty"` +} + +// SoftDeleteSettings - Soft delete related settings +type SoftDeleteSettings struct { + // Soft delete retention duration + RetentionDurationInDays *float64 `json:"retentionDurationInDays,omitempty"` + + // State of soft delete + State *SoftDeleteState `json:"state,omitempty"` +} + // SourceLifeCycle - Source LifeCycle type SourceLifeCycle struct { // REQUIRED; Delete Option @@ -2302,6 +2495,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 diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/models_serde.go b/sdk/resourcemanager/dataprotection/armdataprotection/models_serde.go new file mode 100644 index 000000000000..33bc2556accd --- /dev/null +++ b/sdk/resourcemanager/dataprotection/armdataprotection/models_serde.go @@ -0,0 +1,5037 @@ +//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 ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "time" +) + +// MarshalJSON implements the json.Marshaller interface for type AbsoluteDeleteOption. +func (a AbsoluteDeleteOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "duration", a.Duration) + objectMap["objectType"] = "AbsoluteDeleteOption" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AbsoluteDeleteOption. +func (a *AbsoluteDeleteOption) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "duration": + err = unpopulate(val, "Duration", &a.Duration) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdHocBackupRuleOptions. +func (a AdHocBackupRuleOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ruleName", a.RuleName) + populate(objectMap, "triggerOption", a.TriggerOption) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdHocBackupRuleOptions. +func (a *AdHocBackupRuleOptions) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ruleName": + err = unpopulate(val, "RuleName", &a.RuleName) + delete(rawMsg, key) + case "triggerOption": + err = unpopulate(val, "TriggerOption", &a.TriggerOption) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdhocBackupTriggerOption. +func (a AdhocBackupTriggerOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "retentionTagOverride", a.RetentionTagOverride) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdhocBackupTriggerOption. +func (a *AdhocBackupTriggerOption) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "retentionTagOverride": + err = unpopulate(val, "RetentionTagOverride", &a.RetentionTagOverride) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdhocBasedTaggingCriteria. +func (a AdhocBasedTaggingCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tagInfo", a.TagInfo) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdhocBasedTaggingCriteria. +func (a *AdhocBasedTaggingCriteria) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tagInfo": + err = unpopulate(val, "TagInfo", &a.TagInfo) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AdhocBasedTriggerContext. +func (a AdhocBasedTriggerContext) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "AdhocBasedTriggerContext" + populate(objectMap, "taggingCriteria", a.TaggingCriteria) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdhocBasedTriggerContext. +func (a *AdhocBasedTriggerContext) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) + delete(rawMsg, key) + case "taggingCriteria": + err = unpopulate(val, "TaggingCriteria", &a.TaggingCriteria) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AuthCredentials. +func (a AuthCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = a.ObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthCredentials. +func (a *AuthCredentials) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupDiscreteRecoveryPoint. +func (a AzureBackupDiscreteRecoveryPoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "expiryTime", a.ExpiryTime) + populate(objectMap, "friendlyName", a.FriendlyName) + objectMap["objectType"] = "AzureBackupDiscreteRecoveryPoint" + populate(objectMap, "policyName", a.PolicyName) + populate(objectMap, "policyVersion", a.PolicyVersion) + populate(objectMap, "recoveryPointDataStoresDetails", a.RecoveryPointDataStoresDetails) + populate(objectMap, "recoveryPointId", a.RecoveryPointID) + populateTimeRFC3339(objectMap, "recoveryPointTime", a.RecoveryPointTime) + populate(objectMap, "recoveryPointType", a.RecoveryPointType) + populate(objectMap, "retentionTagName", a.RetentionTagName) + populate(objectMap, "retentionTagVersion", a.RetentionTagVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupDiscreteRecoveryPoint. +func (a *AzureBackupDiscreteRecoveryPoint) 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", a, err) + } + 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) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) + delete(rawMsg, key) + case "policyName": + err = unpopulate(val, "PolicyName", &a.PolicyName) + delete(rawMsg, key) + case "policyVersion": + err = unpopulate(val, "PolicyVersion", &a.PolicyVersion) + delete(rawMsg, key) + case "recoveryPointDataStoresDetails": + err = unpopulate(val, "RecoveryPointDataStoresDetails", &a.RecoveryPointDataStoresDetails) + delete(rawMsg, key) + case "recoveryPointId": + err = unpopulate(val, "RecoveryPointID", &a.RecoveryPointID) + delete(rawMsg, key) + case "recoveryPointTime": + err = unpopulateTimeRFC3339(val, "RecoveryPointTime", &a.RecoveryPointTime) + delete(rawMsg, key) + case "recoveryPointType": + err = unpopulate(val, "RecoveryPointType", &a.RecoveryPointType) + delete(rawMsg, key) + case "retentionTagName": + err = unpopulate(val, "RetentionTagName", &a.RetentionTagName) + delete(rawMsg, key) + case "retentionTagVersion": + err = unpopulate(val, "RetentionTagVersion", &a.RetentionTagVersion) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupFindRestorableTimeRangesRequest. +func (a AzureBackupFindRestorableTimeRangesRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endTime", a.EndTime) + populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) + populate(objectMap, "startTime", a.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupFindRestorableTimeRangesRequest. +func (a *AzureBackupFindRestorableTimeRangesRequest) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulate(val, "EndTime", &a.EndTime) + delete(rawMsg, key) + case "sourceDataStoreType": + err = unpopulate(val, "SourceDataStoreType", &a.SourceDataStoreType) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &a.StartTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupFindRestorableTimeRangesRequestResource. +func (a AzureBackupFindRestorableTimeRangesRequestResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "content", a.Content) + populate(objectMap, "cultureInfo", a.CultureInfo) + populate(objectMap, "httpMethod", a.HTTPMethod) + populate(objectMap, "headers", a.Headers) + populate(objectMap, "parameters", a.Parameters) + populate(objectMap, "subscriptionId", a.SubscriptionID) + populate(objectMap, "supportedGroupVersions", a.SupportedGroupVersions) + populate(objectMap, "uri", a.URI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupFindRestorableTimeRangesRequestResource. +func (a *AzureBackupFindRestorableTimeRangesRequestResource) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "content": + err = unpopulate(val, "Content", &a.Content) + delete(rawMsg, key) + case "cultureInfo": + err = unpopulate(val, "CultureInfo", &a.CultureInfo) + delete(rawMsg, key) + case "httpMethod": + err = unpopulate(val, "HTTPMethod", &a.HTTPMethod) + delete(rawMsg, key) + case "headers": + err = unpopulate(val, "Headers", &a.Headers) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &a.Parameters) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &a.SubscriptionID) + delete(rawMsg, key) + case "supportedGroupVersions": + err = unpopulate(val, "SupportedGroupVersions", &a.SupportedGroupVersions) + delete(rawMsg, key) + case "uri": + err = unpopulate(val, "URI", &a.URI) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupFindRestorableTimeRangesResponse. +func (a AzureBackupFindRestorableTimeRangesResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "objectType", a.ObjectType) + populate(objectMap, "restorableTimeRanges", a.RestorableTimeRanges) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupFindRestorableTimeRangesResponse. +func (a *AzureBackupFindRestorableTimeRangesResponse) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) + delete(rawMsg, key) + case "restorableTimeRanges": + err = unpopulate(val, "RestorableTimeRanges", &a.RestorableTimeRanges) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupFindRestorableTimeRangesResponseResource. +func (a AzureBackupFindRestorableTimeRangesResponseResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupFindRestorableTimeRangesResponseResource. +func (a *AzureBackupFindRestorableTimeRangesResponseResource) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupJob. +func (a AzureBackupJob) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "activityID", a.ActivityID) + populate(objectMap, "backupInstanceFriendlyName", a.BackupInstanceFriendlyName) + populate(objectMap, "backupInstanceId", a.BackupInstanceID) + populate(objectMap, "dataSourceId", a.DataSourceID) + populate(objectMap, "dataSourceLocation", a.DataSourceLocation) + populate(objectMap, "dataSourceName", a.DataSourceName) + populate(objectMap, "dataSourceSetName", a.DataSourceSetName) + populate(objectMap, "dataSourceType", a.DataSourceType) + populate(objectMap, "destinationDataStoreName", a.DestinationDataStoreName) + populate(objectMap, "duration", a.Duration) + populateTimeRFC3339(objectMap, "endTime", a.EndTime) + populate(objectMap, "errorDetails", a.ErrorDetails) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "extendedInfo", a.ExtendedInfo) + populate(objectMap, "isUserTriggered", a.IsUserTriggered) + populate(objectMap, "operation", a.Operation) + populate(objectMap, "operationCategory", a.OperationCategory) + populate(objectMap, "policyId", a.PolicyID) + populate(objectMap, "policyName", a.PolicyName) + populate(objectMap, "progressEnabled", a.ProgressEnabled) + populate(objectMap, "progressUrl", a.ProgressURL) + populate(objectMap, "restoreType", a.RestoreType) + populate(objectMap, "sourceDataStoreName", a.SourceDataStoreName) + populate(objectMap, "sourceResourceGroup", a.SourceResourceGroup) + populate(objectMap, "sourceSubscriptionID", a.SourceSubscriptionID) + populateTimeRFC3339(objectMap, "startTime", a.StartTime) + populate(objectMap, "status", a.Status) + populate(objectMap, "subscriptionId", a.SubscriptionID) + populate(objectMap, "supportedActions", a.SupportedActions) + populate(objectMap, "vaultName", a.VaultName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupJob. +func (a *AzureBackupJob) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activityID": + err = unpopulate(val, "ActivityID", &a.ActivityID) + delete(rawMsg, key) + case "backupInstanceFriendlyName": + err = unpopulate(val, "BackupInstanceFriendlyName", &a.BackupInstanceFriendlyName) + delete(rawMsg, key) + case "backupInstanceId": + err = unpopulate(val, "BackupInstanceID", &a.BackupInstanceID) + delete(rawMsg, key) + case "dataSourceId": + err = unpopulate(val, "DataSourceID", &a.DataSourceID) + delete(rawMsg, key) + case "dataSourceLocation": + err = unpopulate(val, "DataSourceLocation", &a.DataSourceLocation) + delete(rawMsg, key) + case "dataSourceName": + err = unpopulate(val, "DataSourceName", &a.DataSourceName) + delete(rawMsg, key) + case "dataSourceSetName": + err = unpopulate(val, "DataSourceSetName", &a.DataSourceSetName) + delete(rawMsg, key) + case "dataSourceType": + err = unpopulate(val, "DataSourceType", &a.DataSourceType) + delete(rawMsg, key) + case "destinationDataStoreName": + err = unpopulate(val, "DestinationDataStoreName", &a.DestinationDataStoreName) + delete(rawMsg, key) + case "duration": + err = unpopulate(val, "Duration", &a.Duration) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &a.EndTime) + delete(rawMsg, key) + case "errorDetails": + err = unpopulate(val, "ErrorDetails", &a.ErrorDetails) + delete(rawMsg, key) + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "extendedInfo": + err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) + delete(rawMsg, key) + case "isUserTriggered": + err = unpopulate(val, "IsUserTriggered", &a.IsUserTriggered) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &a.Operation) + delete(rawMsg, key) + case "operationCategory": + err = unpopulate(val, "OperationCategory", &a.OperationCategory) + delete(rawMsg, key) + case "policyId": + err = unpopulate(val, "PolicyID", &a.PolicyID) + delete(rawMsg, key) + case "policyName": + err = unpopulate(val, "PolicyName", &a.PolicyName) + delete(rawMsg, key) + case "progressEnabled": + err = unpopulate(val, "ProgressEnabled", &a.ProgressEnabled) + delete(rawMsg, key) + case "progressUrl": + err = unpopulate(val, "ProgressURL", &a.ProgressURL) + delete(rawMsg, key) + case "restoreType": + err = unpopulate(val, "RestoreType", &a.RestoreType) + delete(rawMsg, key) + case "sourceDataStoreName": + err = unpopulate(val, "SourceDataStoreName", &a.SourceDataStoreName) + delete(rawMsg, key) + case "sourceResourceGroup": + err = unpopulate(val, "SourceResourceGroup", &a.SourceResourceGroup) + delete(rawMsg, key) + case "sourceSubscriptionID": + err = unpopulate(val, "SourceSubscriptionID", &a.SourceSubscriptionID) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &a.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &a.SubscriptionID) + delete(rawMsg, key) + case "supportedActions": + err = unpopulate(val, "SupportedActions", &a.SupportedActions) + delete(rawMsg, key) + case "vaultName": + err = unpopulate(val, "VaultName", &a.VaultName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupJobResource. +func (a AzureBackupJobResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupJobResource. +func (a *AzureBackupJobResource) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupJobResourceList. +func (a AzureBackupJobResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupJobResourceList. +func (a *AzureBackupJobResourceList) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupParams. +func (a AzureBackupParams) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backupType", a.BackupType) + objectMap["objectType"] = "AzureBackupParams" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupParams. +func (a *AzureBackupParams) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupType": + err = unpopulate(val, "BackupType", &a.BackupType) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryPoint. +func (a AzureBackupRecoveryPoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = a.ObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRecoveryPoint. +func (a *AzureBackupRecoveryPoint) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryPointBasedRestoreRequest. +func (a AzureBackupRecoveryPointBasedRestoreRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "AzureBackupRecoveryPointBasedRestoreRequest" + populate(objectMap, "recoveryPointId", a.RecoveryPointID) + populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) + populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) + populate(objectMap, "sourceResourceId", a.SourceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRecoveryPointBasedRestoreRequest. +func (a *AzureBackupRecoveryPointBasedRestoreRequest) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) + delete(rawMsg, key) + case "recoveryPointId": + err = unpopulate(val, "RecoveryPointID", &a.RecoveryPointID) + delete(rawMsg, key) + case "restoreTargetInfo": + a.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val) + delete(rawMsg, key) + case "sourceDataStoreType": + err = unpopulate(val, "SourceDataStoreType", &a.SourceDataStoreType) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryPointResource. +func (a AzureBackupRecoveryPointResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRecoveryPointResource. +func (a *AzureBackupRecoveryPointResource) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + a.Properties, err = unmarshalAzureBackupRecoveryPointClassification(val) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryPointResourceList. +func (a AzureBackupRecoveryPointResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRecoveryPointResourceList. +func (a *AzureBackupRecoveryPointResourceList) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryTimeBasedRestoreRequest. +func (a AzureBackupRecoveryTimeBasedRestoreRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "AzureBackupRecoveryTimeBasedRestoreRequest" + populate(objectMap, "recoveryPointTime", a.RecoveryPointTime) + populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) + populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) + populate(objectMap, "sourceResourceId", a.SourceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRecoveryTimeBasedRestoreRequest. +func (a *AzureBackupRecoveryTimeBasedRestoreRequest) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) + delete(rawMsg, key) + case "recoveryPointTime": + err = unpopulate(val, "RecoveryPointTime", &a.RecoveryPointTime) + delete(rawMsg, key) + case "restoreTargetInfo": + a.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val) + delete(rawMsg, key) + case "sourceDataStoreType": + err = unpopulate(val, "SourceDataStoreType", &a.SourceDataStoreType) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupRehydrationRequest. +func (a AzureBackupRehydrationRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "recoveryPointId", a.RecoveryPointID) + populate(objectMap, "rehydrationPriority", a.RehydrationPriority) + populate(objectMap, "rehydrationRetentionDuration", a.RehydrationRetentionDuration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRehydrationRequest. +func (a *AzureBackupRehydrationRequest) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "recoveryPointId": + err = unpopulate(val, "RecoveryPointID", &a.RecoveryPointID) + delete(rawMsg, key) + case "rehydrationPriority": + err = unpopulate(val, "RehydrationPriority", &a.RehydrationPriority) + delete(rawMsg, key) + case "rehydrationRetentionDuration": + err = unpopulate(val, "RehydrationRetentionDuration", &a.RehydrationRetentionDuration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupRestoreRequest. +func (a AzureBackupRestoreRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = a.ObjectType + populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) + populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) + populate(objectMap, "sourceResourceId", a.SourceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRestoreRequest. +func (a *AzureBackupRestoreRequest) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) + delete(rawMsg, key) + case "restoreTargetInfo": + a.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val) + delete(rawMsg, key) + case "sourceDataStoreType": + err = unpopulate(val, "SourceDataStoreType", &a.SourceDataStoreType) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupRestoreWithRehydrationRequest. +func (a AzureBackupRestoreWithRehydrationRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "AzureBackupRestoreWithRehydrationRequest" + populate(objectMap, "recoveryPointId", a.RecoveryPointID) + populate(objectMap, "rehydrationPriority", a.RehydrationPriority) + populate(objectMap, "rehydrationRetentionDuration", a.RehydrationRetentionDuration) + populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) + populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) + populate(objectMap, "sourceResourceId", a.SourceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRestoreWithRehydrationRequest. +func (a *AzureBackupRestoreWithRehydrationRequest) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) + delete(rawMsg, key) + case "recoveryPointId": + err = unpopulate(val, "RecoveryPointID", &a.RecoveryPointID) + delete(rawMsg, key) + case "rehydrationPriority": + err = unpopulate(val, "RehydrationPriority", &a.RehydrationPriority) + delete(rawMsg, key) + case "rehydrationRetentionDuration": + err = unpopulate(val, "RehydrationRetentionDuration", &a.RehydrationRetentionDuration) + delete(rawMsg, key) + case "restoreTargetInfo": + a.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val) + delete(rawMsg, key) + case "sourceDataStoreType": + err = unpopulate(val, "SourceDataStoreType", &a.SourceDataStoreType) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureBackupRule. +func (a AzureBackupRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backupParameters", a.BackupParameters) + populate(objectMap, "dataStore", a.DataStore) + populate(objectMap, "name", a.Name) + objectMap["objectType"] = "AzureBackupRule" + populate(objectMap, "trigger", a.Trigger) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRule. +func (a *AzureBackupRule) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupParameters": + a.BackupParameters, err = unmarshalBackupParametersClassification(val) + delete(rawMsg, key) + case "dataStore": + err = unpopulate(val, "DataStore", &a.DataStore) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) + delete(rawMsg, key) + case "trigger": + a.Trigger, err = unmarshalTriggerContextClassification(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureMonitorAlertSettings. +func (a AzureMonitorAlertSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertsForAllJobFailures", a.AlertsForAllJobFailures) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorAlertSettings. +func (a *AzureMonitorAlertSettings) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertsForAllJobFailures": + err = unpopulate(val, "AlertsForAllJobFailures", &a.AlertsForAllJobFailures) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureOperationalStoreParameters. +func (a AzureOperationalStoreParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataStoreType", a.DataStoreType) + objectMap["objectType"] = "AzureOperationalStoreParameters" + populate(objectMap, "resourceGroupId", a.ResourceGroupID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureOperationalStoreParameters. +func (a *AzureOperationalStoreParameters) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataStoreType": + err = unpopulate(val, "DataStoreType", &a.DataStoreType) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) + delete(rawMsg, key) + case "resourceGroupId": + err = unpopulate(val, "ResourceGroupID", &a.ResourceGroupID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AzureRetentionRule. +func (a AzureRetentionRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isDefault", a.IsDefault) + populate(objectMap, "lifecycles", a.Lifecycles) + populate(objectMap, "name", a.Name) + objectMap["objectType"] = "AzureRetentionRule" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureRetentionRule. +func (a *AzureRetentionRule) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isDefault": + err = unpopulate(val, "IsDefault", &a.IsDefault) + delete(rawMsg, key) + case "lifecycles": + err = unpopulate(val, "Lifecycles", &a.Lifecycles) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &a.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupCriteria. +func (b BackupCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = b.ObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupCriteria. +func (b *BackupCriteria) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &b.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupInstance. +func (b BackupInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currentProtectionState", b.CurrentProtectionState) + populate(objectMap, "dataSourceInfo", b.DataSourceInfo) + populate(objectMap, "dataSourceSetInfo", b.DataSourceSetInfo) + populate(objectMap, "datasourceAuthCredentials", b.DatasourceAuthCredentials) + populate(objectMap, "friendlyName", b.FriendlyName) + populate(objectMap, "objectType", b.ObjectType) + populate(objectMap, "policyInfo", b.PolicyInfo) + populate(objectMap, "protectionErrorDetails", b.ProtectionErrorDetails) + populate(objectMap, "protectionStatus", b.ProtectionStatus) + populate(objectMap, "provisioningState", b.ProvisioningState) + populate(objectMap, "validationType", b.ValidationType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupInstance. +func (b *BackupInstance) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentProtectionState": + err = unpopulate(val, "CurrentProtectionState", &b.CurrentProtectionState) + delete(rawMsg, key) + case "dataSourceInfo": + err = unpopulate(val, "DataSourceInfo", &b.DataSourceInfo) + delete(rawMsg, key) + case "dataSourceSetInfo": + err = unpopulate(val, "DataSourceSetInfo", &b.DataSourceSetInfo) + delete(rawMsg, key) + case "datasourceAuthCredentials": + b.DatasourceAuthCredentials, err = unmarshalAuthCredentialsClassification(val) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &b.FriendlyName) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &b.ObjectType) + delete(rawMsg, key) + case "policyInfo": + err = unpopulate(val, "PolicyInfo", &b.PolicyInfo) + delete(rawMsg, key) + case "protectionErrorDetails": + err = unpopulate(val, "ProtectionErrorDetails", &b.ProtectionErrorDetails) + delete(rawMsg, key) + case "protectionStatus": + err = unpopulate(val, "ProtectionStatus", &b.ProtectionStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &b.ProvisioningState) + delete(rawMsg, key) + case "validationType": + err = unpopulate(val, "ValidationType", &b.ValidationType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupInstanceResource. +func (b BackupInstanceResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "tags", b.Tags) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupInstanceResource. +func (b *BackupInstanceResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &b.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &b.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupInstanceResourceList. +func (b BackupInstanceResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupInstanceResourceList. +func (b *BackupInstanceResourceList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupParameters. +func (b BackupParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = b.ObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupParameters. +func (b *BackupParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &b.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupPolicy. +func (b BackupPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "datasourceTypes", b.DatasourceTypes) + objectMap["objectType"] = "BackupPolicy" + populate(objectMap, "policyRules", b.PolicyRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupPolicy. +func (b *BackupPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "datasourceTypes": + err = unpopulate(val, "DatasourceTypes", &b.DatasourceTypes) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &b.ObjectType) + delete(rawMsg, key) + case "policyRules": + b.PolicyRules, err = unmarshalBasePolicyRuleClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupSchedule. +func (b BackupSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "repeatingTimeIntervals", b.RepeatingTimeIntervals) + populate(objectMap, "timeZone", b.TimeZone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupSchedule. +func (b *BackupSchedule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "repeatingTimeIntervals": + err = unpopulate(val, "RepeatingTimeIntervals", &b.RepeatingTimeIntervals) + delete(rawMsg, key) + case "timeZone": + err = unpopulate(val, "TimeZone", &b.TimeZone) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupVault. +func (b BackupVault) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "featureSettings", b.FeatureSettings) + populate(objectMap, "isVaultProtectedByResourceGuard", b.IsVaultProtectedByResourceGuard) + populate(objectMap, "monitoringSettings", b.MonitoringSettings) + populate(objectMap, "provisioningState", b.ProvisioningState) + populate(objectMap, "resourceMoveDetails", b.ResourceMoveDetails) + populate(objectMap, "resourceMoveState", b.ResourceMoveState) + populate(objectMap, "securitySettings", b.SecuritySettings) + populate(objectMap, "storageSettings", b.StorageSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupVault. +func (b *BackupVault) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "featureSettings": + err = unpopulate(val, "FeatureSettings", &b.FeatureSettings) + delete(rawMsg, key) + case "isVaultProtectedByResourceGuard": + err = unpopulate(val, "IsVaultProtectedByResourceGuard", &b.IsVaultProtectedByResourceGuard) + delete(rawMsg, key) + case "monitoringSettings": + err = unpopulate(val, "MonitoringSettings", &b.MonitoringSettings) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &b.ProvisioningState) + delete(rawMsg, key) + case "resourceMoveDetails": + err = unpopulate(val, "ResourceMoveDetails", &b.ResourceMoveDetails) + delete(rawMsg, key) + case "resourceMoveState": + err = unpopulate(val, "ResourceMoveState", &b.ResourceMoveState) + delete(rawMsg, key) + case "securitySettings": + err = unpopulate(val, "SecuritySettings", &b.SecuritySettings) + delete(rawMsg, key) + case "storageSettings": + err = unpopulate(val, "StorageSettings", &b.StorageSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupVaultResource. +func (b BackupVaultResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "eTag", b.ETag) + populate(objectMap, "id", b.ID) + populate(objectMap, "identity", b.Identity) + populate(objectMap, "location", b.Location) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "tags", b.Tags) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupVaultResource. +func (b *BackupVaultResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eTag": + err = unpopulate(val, "ETag", &b.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &b.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &b.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &b.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &b.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BackupVaultResourceList. +func (b BackupVaultResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BackupVaultResourceList. +func (b *BackupVaultResourceList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BaseBackupPolicy. +func (b BaseBackupPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "datasourceTypes", b.DatasourceTypes) + objectMap["objectType"] = b.ObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaseBackupPolicy. +func (b *BaseBackupPolicy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "datasourceTypes": + err = unpopulate(val, "DatasourceTypes", &b.DatasourceTypes) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &b.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BaseBackupPolicyResource. +func (b BaseBackupPolicyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaseBackupPolicyResource. +func (b *BaseBackupPolicyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + b.Properties, err = unmarshalBaseBackupPolicyClassification(val) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &b.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BaseBackupPolicyResourceList. +func (b BaseBackupPolicyResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaseBackupPolicyResourceList. +func (b *BaseBackupPolicyResourceList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BasePolicyRule. +func (b BasePolicyRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", b.Name) + objectMap["objectType"] = b.ObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BasePolicyRule. +func (b *BasePolicyRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &b.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityRequest. +func (c CheckNameAvailabilityRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityRequest. +func (c *CheckNameAvailabilityRequest) 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 "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + 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 CheckNameAvailabilityResult. +func (c CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResult. +func (c *CheckNameAvailabilityResult) 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 "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + 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 ClientDiscoveryDisplay. +func (c ClientDiscoveryDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", c.Description) + populate(objectMap, "operation", c.Operation) + populate(objectMap, "provider", c.Provider) + populate(objectMap, "resource", c.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientDiscoveryDisplay. +func (c *ClientDiscoveryDisplay) 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 "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &c.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &c.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &c.Resource) + 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 ClientDiscoveryForLogSpecification. +func (c ClientDiscoveryForLogSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "blobDuration", c.BlobDuration) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "name", c.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientDiscoveryForLogSpecification. +func (c *ClientDiscoveryForLogSpecification) 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 "blobDuration": + err = unpopulate(val, "BlobDuration", &c.BlobDuration) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + 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 ClientDiscoveryForProperties. +func (c ClientDiscoveryForProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "serviceSpecification", c.ServiceSpecification) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientDiscoveryForProperties. +func (c *ClientDiscoveryForProperties) 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 "serviceSpecification": + err = unpopulate(val, "ServiceSpecification", &c.ServiceSpecification) + 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 ClientDiscoveryForServiceSpecification. +func (c ClientDiscoveryForServiceSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logSpecifications", c.LogSpecifications) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientDiscoveryForServiceSpecification. +func (c *ClientDiscoveryForServiceSpecification) 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 "logSpecifications": + err = unpopulate(val, "LogSpecifications", &c.LogSpecifications) + 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 ClientDiscoveryResponse. +func (c ClientDiscoveryResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientDiscoveryResponse. +func (c *ClientDiscoveryResponse) 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 "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + 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 ClientDiscoveryValueForSingleAPI. +func (c ClientDiscoveryValueForSingleAPI) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", c.Display) + populate(objectMap, "isDataAction", c.IsDataAction) + populate(objectMap, "name", c.Name) + populate(objectMap, "origin", c.Origin) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientDiscoveryValueForSingleAPI. +func (c *ClientDiscoveryValueForSingleAPI) 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 "display": + err = unpopulate(val, "Display", &c.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &c.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &c.Origin) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + 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 CopyOnExpiryOption. +func (c CopyOnExpiryOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "CopyOnExpiryOption" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CopyOnExpiryOption. +func (c *CopyOnExpiryOption) 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 "objectType": + err = unpopulate(val, "ObjectType", &c.ObjectType) + 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 CopyOption. +func (c CopyOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = c.ObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CopyOption. +func (c *CopyOption) 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 "objectType": + err = unpopulate(val, "ObjectType", &c.ObjectType) + 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 CrossSubscriptionRestoreSettings. +func (c CrossSubscriptionRestoreSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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{}) + populate(objectMap, "duration", c.Duration) + objectMap["objectType"] = "CustomCopyOption" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomCopyOption. +func (c *CustomCopyOption) 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 "duration": + err = unpopulate(val, "Duration", &c.Duration) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &c.ObjectType) + 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 DataStoreInfoBase. +func (d DataStoreInfoBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataStoreType", d.DataStoreType) + populate(objectMap, "objectType", d.ObjectType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataStoreInfoBase. +func (d *DataStoreInfoBase) 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 "dataStoreType": + err = unpopulate(val, "DataStoreType", &d.DataStoreType) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &d.ObjectType) + 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 DataStoreParameters. +func (d DataStoreParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataStoreType", d.DataStoreType) + objectMap["objectType"] = d.ObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataStoreParameters. +func (d *DataStoreParameters) 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 "dataStoreType": + err = unpopulate(val, "DataStoreType", &d.DataStoreType) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &d.ObjectType) + 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 Datasource. +func (d Datasource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "datasourceType", d.DatasourceType) + populate(objectMap, "objectType", d.ObjectType) + populate(objectMap, "resourceID", d.ResourceID) + populate(objectMap, "resourceLocation", d.ResourceLocation) + populate(objectMap, "resourceName", d.ResourceName) + populate(objectMap, "resourceType", d.ResourceType) + populate(objectMap, "resourceUri", d.ResourceURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Datasource. +func (d *Datasource) 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 "datasourceType": + err = unpopulate(val, "DatasourceType", &d.DatasourceType) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &d.ObjectType) + delete(rawMsg, key) + case "resourceID": + err = unpopulate(val, "ResourceID", &d.ResourceID) + delete(rawMsg, key) + case "resourceLocation": + err = unpopulate(val, "ResourceLocation", &d.ResourceLocation) + delete(rawMsg, key) + case "resourceName": + err = unpopulate(val, "ResourceName", &d.ResourceName) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &d.ResourceType) + delete(rawMsg, key) + case "resourceUri": + err = unpopulate(val, "ResourceURI", &d.ResourceURI) + 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 DatasourceSet. +func (d DatasourceSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "datasourceType", d.DatasourceType) + populate(objectMap, "objectType", d.ObjectType) + populate(objectMap, "resourceID", d.ResourceID) + populate(objectMap, "resourceLocation", d.ResourceLocation) + populate(objectMap, "resourceName", d.ResourceName) + populate(objectMap, "resourceType", d.ResourceType) + populate(objectMap, "resourceUri", d.ResourceURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatasourceSet. +func (d *DatasourceSet) 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 "datasourceType": + err = unpopulate(val, "DatasourceType", &d.DatasourceType) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &d.ObjectType) + delete(rawMsg, key) + case "resourceID": + err = unpopulate(val, "ResourceID", &d.ResourceID) + delete(rawMsg, key) + case "resourceLocation": + err = unpopulate(val, "ResourceLocation", &d.ResourceLocation) + delete(rawMsg, key) + case "resourceName": + err = unpopulate(val, "ResourceName", &d.ResourceName) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &d.ResourceType) + delete(rawMsg, key) + case "resourceUri": + err = unpopulate(val, "ResourceURI", &d.ResourceURI) + 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 Day. +func (d Day) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "date", d.Date) + populate(objectMap, "isLast", d.IsLast) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Day. +func (d *Day) 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 "date": + err = unpopulate(val, "Date", &d.Date) + delete(rawMsg, key) + case "isLast": + err = unpopulate(val, "IsLast", &d.IsLast) + 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 DeleteOption. +func (d DeleteOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "duration", d.Duration) + objectMap["objectType"] = d.ObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeleteOption. +func (d *DeleteOption) 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 "duration": + err = unpopulate(val, "Duration", &d.Duration) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &d.ObjectType) + 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 DeletedBackupInstance. +func (d DeletedBackupInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "currentProtectionState", d.CurrentProtectionState) + populate(objectMap, "dataSourceInfo", d.DataSourceInfo) + populate(objectMap, "dataSourceSetInfo", d.DataSourceSetInfo) + populate(objectMap, "datasourceAuthCredentials", d.DatasourceAuthCredentials) + populate(objectMap, "deletionInfo", d.DeletionInfo) + populate(objectMap, "friendlyName", d.FriendlyName) + populate(objectMap, "objectType", d.ObjectType) + populate(objectMap, "policyInfo", d.PolicyInfo) + populate(objectMap, "protectionErrorDetails", d.ProtectionErrorDetails) + populate(objectMap, "protectionStatus", d.ProtectionStatus) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "validationType", d.ValidationType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedBackupInstance. +func (d *DeletedBackupInstance) 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 "currentProtectionState": + err = unpopulate(val, "CurrentProtectionState", &d.CurrentProtectionState) + delete(rawMsg, key) + case "dataSourceInfo": + err = unpopulate(val, "DataSourceInfo", &d.DataSourceInfo) + delete(rawMsg, key) + case "dataSourceSetInfo": + err = unpopulate(val, "DataSourceSetInfo", &d.DataSourceSetInfo) + delete(rawMsg, key) + case "datasourceAuthCredentials": + d.DatasourceAuthCredentials, err = unmarshalAuthCredentialsClassification(val) + delete(rawMsg, key) + case "deletionInfo": + err = unpopulate(val, "DeletionInfo", &d.DeletionInfo) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &d.FriendlyName) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &d.ObjectType) + delete(rawMsg, key) + case "policyInfo": + err = unpopulate(val, "PolicyInfo", &d.PolicyInfo) + delete(rawMsg, key) + case "protectionErrorDetails": + err = unpopulate(val, "ProtectionErrorDetails", &d.ProtectionErrorDetails) + delete(rawMsg, key) + case "protectionStatus": + err = unpopulate(val, "ProtectionStatus", &d.ProtectionStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "validationType": + err = unpopulate(val, "ValidationType", &d.ValidationType) + 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 DeletedBackupInstanceResource. +func (d DeletedBackupInstanceResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedBackupInstanceResource. +func (d *DeletedBackupInstanceResource) 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 "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + 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 DeletedBackupInstanceResourceList. +func (d DeletedBackupInstanceResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletedBackupInstanceResourceList. +func (d *DeletedBackupInstanceResourceList) 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 "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + 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 DeletionInfo. +func (d DeletionInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "billingEndDate", d.BillingEndDate) + populate(objectMap, "deleteActivityID", d.DeleteActivityID) + populate(objectMap, "deletionTime", d.DeletionTime) + populate(objectMap, "scheduledPurgeTime", d.ScheduledPurgeTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeletionInfo. +func (d *DeletionInfo) 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 "billingEndDate": + err = unpopulate(val, "BillingEndDate", &d.BillingEndDate) + delete(rawMsg, key) + case "deleteActivityID": + err = unpopulate(val, "DeleteActivityID", &d.DeleteActivityID) + delete(rawMsg, key) + case "deletionTime": + err = unpopulate(val, "DeletionTime", &d.DeletionTime) + delete(rawMsg, key) + case "scheduledPurgeTime": + err = unpopulate(val, "ScheduledPurgeTime", &d.ScheduledPurgeTime) + 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 DppBaseResource. +func (d DppBaseResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DppBaseResource. +func (d *DppBaseResource) 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 "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + 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 DppBaseResourceList. +func (d DppBaseResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DppBaseResourceList. +func (d *DppBaseResourceList) 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 "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + 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 DppBaseTrackedResource. +func (d DppBaseTrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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{}) + populate(objectMap, "principalId", d.PrincipalID) + populate(objectMap, "tenantId", d.TenantID) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DppIdentityDetails. +func (d *DppIdentityDetails) 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 "principalId": + err = unpopulate(val, "PrincipalID", &d.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &d.TenantID) + 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 DppProxyResource. +func (d DppProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + 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 DppProxyResource. +func (d *DppProxyResource) 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 "id": + err = unpopulate(val, "ID", &d.ID) + 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 DppResource. +func (d DppResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DppResource. +func (d *DppResource) 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 "id": + err = unpopulate(val, "ID", &d.ID) + 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 "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 DppResourceList. +func (d DppResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DppResourceList. +func (d *DppResourceList) 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 "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + 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 DppTrackedResource. +func (d DppTrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "eTag", d.ETag) + populate(objectMap, "id", d.ID) + populate(objectMap, "identity", d.Identity) + 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 DppTrackedResource. +func (d *DppTrackedResource) 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 "identity": + err = unpopulate(val, "Identity", &d.Identity) + 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 DppTrackedResourceList. +func (d DppTrackedResourceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DppTrackedResourceList. +func (d *DppTrackedResourceList) 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 "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + 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 DppWorkerRequest. +func (d DppWorkerRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cultureInfo", d.CultureInfo) + populate(objectMap, "httpMethod", d.HTTPMethod) + populate(objectMap, "headers", d.Headers) + populate(objectMap, "parameters", d.Parameters) + populate(objectMap, "subscriptionId", d.SubscriptionID) + populate(objectMap, "supportedGroupVersions", d.SupportedGroupVersions) + populate(objectMap, "uri", d.URI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DppWorkerRequest. +func (d *DppWorkerRequest) 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 "cultureInfo": + err = unpopulate(val, "CultureInfo", &d.CultureInfo) + delete(rawMsg, key) + case "httpMethod": + err = unpopulate(val, "HTTPMethod", &d.HTTPMethod) + delete(rawMsg, key) + case "headers": + err = unpopulate(val, "Headers", &d.Headers) + delete(rawMsg, key) + case "parameters": + err = unpopulate(val, "Parameters", &d.Parameters) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &d.SubscriptionID) + delete(rawMsg, key) + case "supportedGroupVersions": + err = unpopulate(val, "SupportedGroupVersions", &d.SupportedGroupVersions) + delete(rawMsg, key) + case "uri": + err = unpopulate(val, "URI", &d.URI) + 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 Error. +func (e Error) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Error. +func (e *Error) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExportJobsResult. +func (e ExportJobsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "blobSasKey", e.BlobSasKey) + populate(objectMap, "blobUrl", e.BlobURL) + populate(objectMap, "excelFileBlobSasKey", e.ExcelFileBlobSasKey) + populate(objectMap, "excelFileBlobUrl", e.ExcelFileBlobURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExportJobsResult. +func (e *ExportJobsResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobSasKey": + err = unpopulate(val, "BlobSasKey", &e.BlobSasKey) + delete(rawMsg, key) + case "blobUrl": + err = unpopulate(val, "BlobURL", &e.BlobURL) + delete(rawMsg, key) + case "excelFileBlobSasKey": + err = unpopulate(val, "ExcelFileBlobSasKey", &e.ExcelFileBlobSasKey) + delete(rawMsg, key) + case "excelFileBlobUrl": + err = unpopulate(val, "ExcelFileBlobURL", &e.ExcelFileBlobURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FeatureSettings. +func (f FeatureSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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{}) + populate(objectMap, "featureName", f.FeatureName) + populate(objectMap, "featureType", f.FeatureType) + objectMap["objectType"] = "FeatureValidationRequest" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FeatureValidationRequest. +func (f *FeatureValidationRequest) 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 "featureName": + err = unpopulate(val, "FeatureName", &f.FeatureName) + delete(rawMsg, key) + case "featureType": + err = unpopulate(val, "FeatureType", &f.FeatureType) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &f.ObjectType) + 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 FeatureValidationRequestBase. +func (f FeatureValidationRequestBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = f.ObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FeatureValidationRequestBase. +func (f *FeatureValidationRequestBase) 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 "objectType": + err = unpopulate(val, "ObjectType", &f.ObjectType) + 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 FeatureValidationResponse. +func (f FeatureValidationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "featureType", f.FeatureType) + populate(objectMap, "features", f.Features) + objectMap["objectType"] = "FeatureValidationResponse" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FeatureValidationResponse. +func (f *FeatureValidationResponse) 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 "featureType": + err = unpopulate(val, "FeatureType", &f.FeatureType) + delete(rawMsg, key) + case "features": + err = unpopulate(val, "Features", &f.Features) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &f.ObjectType) + 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 FeatureValidationResponseBase. +func (f FeatureValidationResponseBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = f.ObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FeatureValidationResponseBase. +func (f *FeatureValidationResponseBase) 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 "objectType": + err = unpopulate(val, "ObjectType", &f.ObjectType) + 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 ImmediateCopyOption. +func (i ImmediateCopyOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "ImmediateCopyOption" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImmediateCopyOption. +func (i *ImmediateCopyOption) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &i.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ImmutabilitySettings. +func (i ImmutabilitySettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "state", i.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ImmutabilitySettings. +func (i *ImmutabilitySettings) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &i.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InnerError. +func (i InnerError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", i.AdditionalInfo) + populate(objectMap, "code", i.Code) + populate(objectMap, "embeddedInnerError", i.EmbeddedInnerError) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InnerError. +func (i *InnerError) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &i.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &i.Code) + delete(rawMsg, key) + case "embeddedInnerError": + err = unpopulate(val, "EmbeddedInnerError", &i.EmbeddedInnerError) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ItemLevelRestoreCriteria. +func (i ItemLevelRestoreCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = i.ObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ItemLevelRestoreCriteria. +func (i *ItemLevelRestoreCriteria) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &i.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ItemLevelRestoreTargetInfo. +func (i ItemLevelRestoreTargetInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "datasourceAuthCredentials", i.DatasourceAuthCredentials) + populate(objectMap, "datasourceInfo", i.DatasourceInfo) + populate(objectMap, "datasourceSetInfo", i.DatasourceSetInfo) + objectMap["objectType"] = "ItemLevelRestoreTargetInfo" + populate(objectMap, "recoveryOption", i.RecoveryOption) + populate(objectMap, "restoreCriteria", i.RestoreCriteria) + populate(objectMap, "restoreLocation", i.RestoreLocation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ItemLevelRestoreTargetInfo. +func (i *ItemLevelRestoreTargetInfo) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "datasourceAuthCredentials": + i.DatasourceAuthCredentials, err = unmarshalAuthCredentialsClassification(val) + delete(rawMsg, key) + case "datasourceInfo": + err = unpopulate(val, "DatasourceInfo", &i.DatasourceInfo) + delete(rawMsg, key) + case "datasourceSetInfo": + err = unpopulate(val, "DatasourceSetInfo", &i.DatasourceSetInfo) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &i.ObjectType) + delete(rawMsg, key) + case "recoveryOption": + err = unpopulate(val, "RecoveryOption", &i.RecoveryOption) + delete(rawMsg, key) + case "restoreCriteria": + i.RestoreCriteria, err = unmarshalItemLevelRestoreCriteriaClassificationArray(val) + delete(rawMsg, key) + case "restoreLocation": + err = unpopulate(val, "RestoreLocation", &i.RestoreLocation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobExtendedInfo. +func (j JobExtendedInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalDetails", j.AdditionalDetails) + populate(objectMap, "backupInstanceState", j.BackupInstanceState) + populate(objectMap, "dataTransferredInBytes", j.DataTransferredInBytes) + populate(objectMap, "recoveryDestination", j.RecoveryDestination) + populate(objectMap, "sourceRecoverPoint", j.SourceRecoverPoint) + populate(objectMap, "subTasks", j.SubTasks) + populate(objectMap, "targetRecoverPoint", j.TargetRecoverPoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobExtendedInfo. +func (j *JobExtendedInfo) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalDetails": + err = unpopulate(val, "AdditionalDetails", &j.AdditionalDetails) + delete(rawMsg, key) + case "backupInstanceState": + err = unpopulate(val, "BackupInstanceState", &j.BackupInstanceState) + delete(rawMsg, key) + case "dataTransferredInBytes": + err = unpopulate(val, "DataTransferredInBytes", &j.DataTransferredInBytes) + delete(rawMsg, key) + case "recoveryDestination": + err = unpopulate(val, "RecoveryDestination", &j.RecoveryDestination) + delete(rawMsg, key) + case "sourceRecoverPoint": + err = unpopulate(val, "SourceRecoverPoint", &j.SourceRecoverPoint) + delete(rawMsg, key) + case "subTasks": + err = unpopulate(val, "SubTasks", &j.SubTasks) + delete(rawMsg, key) + case "targetRecoverPoint": + err = unpopulate(val, "TargetRecoverPoint", &j.TargetRecoverPoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobSubTask. +func (j JobSubTask) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalDetails", j.AdditionalDetails) + populate(objectMap, "taskId", j.TaskID) + populate(objectMap, "taskName", j.TaskName) + populate(objectMap, "taskProgress", j.TaskProgress) + populate(objectMap, "taskStatus", j.TaskStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobSubTask. +func (j *JobSubTask) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalDetails": + err = unpopulate(val, "AdditionalDetails", &j.AdditionalDetails) + delete(rawMsg, key) + case "taskId": + err = unpopulate(val, "TaskID", &j.TaskID) + delete(rawMsg, key) + case "taskName": + err = unpopulate(val, "TaskName", &j.TaskName) + delete(rawMsg, key) + case "taskProgress": + err = unpopulate(val, "TaskProgress", &j.TaskProgress) + delete(rawMsg, key) + case "taskStatus": + err = unpopulate(val, "TaskStatus", &j.TaskStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesPVRestoreCriteria. +func (k KubernetesPVRestoreCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", k.Name) + objectMap["objectType"] = "KubernetesPVRestoreCriteria" + populate(objectMap, "storageClassName", k.StorageClassName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesPVRestoreCriteria. +func (k *KubernetesPVRestoreCriteria) 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", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &k.Name) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &k.ObjectType) + delete(rawMsg, key) + case "storageClassName": + err = unpopulate(val, "StorageClassName", &k.StorageClassName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KubernetesStorageClassRestoreCriteria. +func (k KubernetesStorageClassRestoreCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "KubernetesStorageClassRestoreCriteria" + populate(objectMap, "provisioner", k.Provisioner) + populate(objectMap, "selectedStorageClassName", k.SelectedStorageClassName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesStorageClassRestoreCriteria. +func (k *KubernetesStorageClassRestoreCriteria) 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", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &k.ObjectType) + delete(rawMsg, key) + case "provisioner": + err = unpopulate(val, "Provisioner", &k.Provisioner) + delete(rawMsg, key) + case "selectedStorageClassName": + err = unpopulate(val, "SelectedStorageClassName", &k.SelectedStorageClassName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitoringSettings. +func (m MonitoringSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureMonitorAlertSettings", m.AzureMonitorAlertSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitoringSettings. +func (m *MonitoringSettings) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureMonitorAlertSettings": + err = unpopulate(val, "AzureMonitorAlertSettings", &m.AzureMonitorAlertSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationExtendedInfo. +func (o OperationExtendedInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = o.ObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationExtendedInfo. +func (o *OperationExtendedInfo) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &o.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationJobExtendedInfo. +func (o OperationJobExtendedInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "jobId", o.JobID) + objectMap["objectType"] = "OperationJobExtendedInfo" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationJobExtendedInfo. +func (o *OperationJobExtendedInfo) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "jobId": + err = unpopulate(val, "JobID", &o.JobID) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &o.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationResource. +func (o OperationResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populateTimeRFC3339(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResource. +func (o *OperationResource) 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", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &o.EndTime) + delete(rawMsg, key) + case "error": + err = unpopulate(val, "Error", &o.Error) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + o.Properties, err = unmarshalOperationExtendedInfoClassification(val) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &o.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &o.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PatchBackupVaultInput. +func (p PatchBackupVaultInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "featureSettings", p.FeatureSettings) + populate(objectMap, "monitoringSettings", p.MonitoringSettings) + populate(objectMap, "securitySettings", p.SecuritySettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchBackupVaultInput. +func (p *PatchBackupVaultInput) 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 "featureSettings": + err = unpopulate(val, "FeatureSettings", &p.FeatureSettings) + delete(rawMsg, key) + case "monitoringSettings": + err = unpopulate(val, "MonitoringSettings", &p.MonitoringSettings) + delete(rawMsg, key) + case "securitySettings": + err = unpopulate(val, "SecuritySettings", &p.SecuritySettings) + 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 PatchResourceGuardInput. +func (p PatchResourceGuardInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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{}) + populate(objectMap, "identity", p.Identity) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PatchResourceRequestInput. +func (p *PatchResourceRequestInput) 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 "identity": + err = unpopulate(val, "Identity", &p.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, 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 PolicyInfo. +func (p PolicyInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "policyId", p.PolicyID) + populate(objectMap, "policyParameters", p.PolicyParameters) + populate(objectMap, "policyVersion", p.PolicyVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyInfo. +func (p *PolicyInfo) 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 "policyId": + err = unpopulate(val, "PolicyID", &p.PolicyID) + delete(rawMsg, key) + case "policyParameters": + err = unpopulate(val, "PolicyParameters", &p.PolicyParameters) + delete(rawMsg, key) + case "policyVersion": + err = unpopulate(val, "PolicyVersion", &p.PolicyVersion) + 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 PolicyParameters. +func (p PolicyParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataStoreParametersList", p.DataStoreParametersList) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyParameters. +func (p *PolicyParameters) 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 "dataStoreParametersList": + p.DataStoreParametersList, err = unmarshalDataStoreParametersClassificationArray(val) + 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 ProtectionStatusDetails. +func (p ProtectionStatusDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errorDetails", p.ErrorDetails) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectionStatusDetails. +func (p *ProtectionStatusDetails) 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 "errorDetails": + err = unpopulate(val, "ErrorDetails", &p.ErrorDetails) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + 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 RangeBasedItemLevelRestoreCriteria. +func (r RangeBasedItemLevelRestoreCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "maxMatchingValue", r.MaxMatchingValue) + populate(objectMap, "minMatchingValue", r.MinMatchingValue) + objectMap["objectType"] = "RangeBasedItemLevelRestoreCriteria" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RangeBasedItemLevelRestoreCriteria. +func (r *RangeBasedItemLevelRestoreCriteria) 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 "maxMatchingValue": + err = unpopulate(val, "MaxMatchingValue", &r.MaxMatchingValue) + delete(rawMsg, key) + case "minMatchingValue": + err = unpopulate(val, "MinMatchingValue", &r.MinMatchingValue) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &r.ObjectType) + 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 RecoveryPointDataStoreDetails. +func (r RecoveryPointDataStoreDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "creationTime", r.CreationTime) + populateTimeRFC3339(objectMap, "expiryTime", r.ExpiryTime) + populate(objectMap, "id", r.ID) + populate(objectMap, "metaData", r.MetaData) + populateTimeRFC3339(objectMap, "rehydrationExpiryTime", r.RehydrationExpiryTime) + populate(objectMap, "rehydrationStatus", r.RehydrationStatus) + populate(objectMap, "state", r.State) + populate(objectMap, "type", r.Type) + populate(objectMap, "visible", r.Visible) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointDataStoreDetails. +func (r *RecoveryPointDataStoreDetails) 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 "creationTime": + err = unpopulateTimeRFC3339(val, "CreationTime", &r.CreationTime) + delete(rawMsg, key) + case "expiryTime": + err = unpopulateTimeRFC3339(val, "ExpiryTime", &r.ExpiryTime) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "metaData": + err = unpopulate(val, "MetaData", &r.MetaData) + delete(rawMsg, key) + case "rehydrationExpiryTime": + err = unpopulateTimeRFC3339(val, "RehydrationExpiryTime", &r.RehydrationExpiryTime) + delete(rawMsg, key) + case "rehydrationStatus": + err = unpopulate(val, "RehydrationStatus", &r.RehydrationStatus) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &r.State) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + case "visible": + err = unpopulate(val, "Visible", &r.Visible) + 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 RecoveryPointsFilters. +func (r RecoveryPointsFilters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endDate", r.EndDate) + populate(objectMap, "extendedInfo", r.ExtendedInfo) + populate(objectMap, "isVisible", r.IsVisible) + populate(objectMap, "restorePointDataStoreId", r.RestorePointDataStoreID) + populate(objectMap, "restorePointState", r.RestorePointState) + populate(objectMap, "startDate", r.StartDate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointsFilters. +func (r *RecoveryPointsFilters) 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 "endDate": + err = unpopulate(val, "EndDate", &r.EndDate) + delete(rawMsg, key) + case "extendedInfo": + err = unpopulate(val, "ExtendedInfo", &r.ExtendedInfo) + delete(rawMsg, key) + case "isVisible": + err = unpopulate(val, "IsVisible", &r.IsVisible) + delete(rawMsg, key) + case "restorePointDataStoreId": + err = unpopulate(val, "RestorePointDataStoreID", &r.RestorePointDataStoreID) + delete(rawMsg, key) + case "restorePointState": + err = unpopulate(val, "RestorePointState", &r.RestorePointState) + delete(rawMsg, key) + case "startDate": + err = unpopulate(val, "StartDate", &r.StartDate) + 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 ResourceGuard. +func (r ResourceGuard) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowAutoApprovals", r.AllowAutoApprovals) + populate(objectMap, "description", r.Description) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "resourceGuardOperations", r.ResourceGuardOperations) + populate(objectMap, "vaultCriticalOperationExclusionList", r.VaultCriticalOperationExclusionList) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGuard. +func (r *ResourceGuard) 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 "allowAutoApprovals": + err = unpopulate(val, "AllowAutoApprovals", &r.AllowAutoApprovals) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "resourceGuardOperations": + err = unpopulate(val, "ResourceGuardOperations", &r.ResourceGuardOperations) + delete(rawMsg, key) + case "vaultCriticalOperationExclusionList": + err = unpopulate(val, "VaultCriticalOperationExclusionList", &r.VaultCriticalOperationExclusionList) + 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 ResourceGuardOperation. +func (r ResourceGuardOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "requestResourceType", r.RequestResourceType) + populate(objectMap, "vaultCriticalOperation", r.VaultCriticalOperation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGuardOperation. +func (r *ResourceGuardOperation) 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 "requestResourceType": + err = unpopulate(val, "RequestResourceType", &r.RequestResourceType) + 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 ResourceGuardResource. +func (r ResourceGuardResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "eTag", r.ETag) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGuardResource. +func (r *ResourceGuardResource) 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 "eTag": + err = unpopulate(val, "ETag", &r.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &r.Location) + 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 "tags": + err = unpopulate(val, "Tags", &r.Tags) + 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 ResourceGuardResourceList. +func (r ResourceGuardResourceList) 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 ResourceGuardResourceList. +func (r *ResourceGuardResourceList) 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 ResourceMoveDetails. +func (r ResourceMoveDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "completionTimeUtc", r.CompletionTimeUTC) + populate(objectMap, "operationId", r.OperationID) + populate(objectMap, "sourceResourcePath", r.SourceResourcePath) + populate(objectMap, "startTimeUtc", r.StartTimeUTC) + populate(objectMap, "targetResourcePath", r.TargetResourcePath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceMoveDetails. +func (r *ResourceMoveDetails) 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 "completionTimeUtc": + err = unpopulate(val, "CompletionTimeUTC", &r.CompletionTimeUTC) + delete(rawMsg, key) + case "operationId": + err = unpopulate(val, "OperationID", &r.OperationID) + delete(rawMsg, key) + case "sourceResourcePath": + err = unpopulate(val, "SourceResourcePath", &r.SourceResourcePath) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulate(val, "StartTimeUTC", &r.StartTimeUTC) + delete(rawMsg, key) + case "targetResourcePath": + err = unpopulate(val, "TargetResourcePath", &r.TargetResourcePath) + 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 RestorableTimeRange. +func (r RestorableTimeRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endTime", r.EndTime) + populate(objectMap, "objectType", r.ObjectType) + populate(objectMap, "startTime", r.StartTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorableTimeRange. +func (r *RestorableTimeRange) 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 "endTime": + err = unpopulate(val, "EndTime", &r.EndTime) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &r.ObjectType) + delete(rawMsg, key) + case "startTime": + err = unpopulate(val, "StartTime", &r.StartTime) + 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 RestoreFilesTargetInfo. +func (r RestoreFilesTargetInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "RestoreFilesTargetInfo" + populate(objectMap, "recoveryOption", r.RecoveryOption) + populate(objectMap, "restoreLocation", r.RestoreLocation) + populate(objectMap, "targetDetails", r.TargetDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreFilesTargetInfo. +func (r *RestoreFilesTargetInfo) 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 "objectType": + err = unpopulate(val, "ObjectType", &r.ObjectType) + delete(rawMsg, key) + case "recoveryOption": + err = unpopulate(val, "RecoveryOption", &r.RecoveryOption) + delete(rawMsg, key) + case "restoreLocation": + err = unpopulate(val, "RestoreLocation", &r.RestoreLocation) + delete(rawMsg, key) + case "targetDetails": + err = unpopulate(val, "TargetDetails", &r.TargetDetails) + 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 RestoreJobRecoveryPointDetails. +func (r RestoreJobRecoveryPointDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "recoveryPointID", r.RecoveryPointID) + populateTimeRFC3339(objectMap, "recoveryPointTime", r.RecoveryPointTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreJobRecoveryPointDetails. +func (r *RestoreJobRecoveryPointDetails) 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 "recoveryPointID": + err = unpopulate(val, "RecoveryPointID", &r.RecoveryPointID) + delete(rawMsg, key) + case "recoveryPointTime": + err = unpopulateTimeRFC3339(val, "RecoveryPointTime", &r.RecoveryPointTime) + 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 RestoreTargetInfo. +func (r RestoreTargetInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "datasourceAuthCredentials", r.DatasourceAuthCredentials) + populate(objectMap, "datasourceInfo", r.DatasourceInfo) + populate(objectMap, "datasourceSetInfo", r.DatasourceSetInfo) + objectMap["objectType"] = "RestoreTargetInfo" + populate(objectMap, "recoveryOption", r.RecoveryOption) + populate(objectMap, "restoreLocation", r.RestoreLocation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreTargetInfo. +func (r *RestoreTargetInfo) 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 "datasourceAuthCredentials": + r.DatasourceAuthCredentials, err = unmarshalAuthCredentialsClassification(val) + delete(rawMsg, key) + case "datasourceInfo": + err = unpopulate(val, "DatasourceInfo", &r.DatasourceInfo) + delete(rawMsg, key) + case "datasourceSetInfo": + err = unpopulate(val, "DatasourceSetInfo", &r.DatasourceSetInfo) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &r.ObjectType) + delete(rawMsg, key) + case "recoveryOption": + err = unpopulate(val, "RecoveryOption", &r.RecoveryOption) + delete(rawMsg, key) + case "restoreLocation": + err = unpopulate(val, "RestoreLocation", &r.RestoreLocation) + 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 RestoreTargetInfoBase. +func (r RestoreTargetInfoBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = r.ObjectType + populate(objectMap, "recoveryOption", r.RecoveryOption) + populate(objectMap, "restoreLocation", r.RestoreLocation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreTargetInfoBase. +func (r *RestoreTargetInfoBase) 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 "objectType": + err = unpopulate(val, "ObjectType", &r.ObjectType) + delete(rawMsg, key) + case "recoveryOption": + err = unpopulate(val, "RecoveryOption", &r.RecoveryOption) + delete(rawMsg, key) + case "restoreLocation": + err = unpopulate(val, "RestoreLocation", &r.RestoreLocation) + 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 RetentionTag. +func (r RetentionTag) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "eTag", r.ETag) + populate(objectMap, "id", r.ID) + populate(objectMap, "tagName", r.TagName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RetentionTag. +func (r *RetentionTag) 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 "eTag": + err = unpopulate(val, "ETag", &r.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "tagName": + err = unpopulate(val, "TagName", &r.TagName) + 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 ScheduleBasedBackupCriteria. +func (s ScheduleBasedBackupCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "absoluteCriteria", s.AbsoluteCriteria) + populate(objectMap, "daysOfMonth", s.DaysOfMonth) + populate(objectMap, "daysOfTheWeek", s.DaysOfTheWeek) + populate(objectMap, "monthsOfYear", s.MonthsOfYear) + objectMap["objectType"] = "ScheduleBasedBackupCriteria" + aux := make([]*timeRFC3339, len(s.ScheduleTimes), len(s.ScheduleTimes)) + for i := 0; i < len(s.ScheduleTimes); i++ { + aux[i] = (*timeRFC3339)(s.ScheduleTimes[i]) + } + populate(objectMap, "scheduleTimes", aux) + populate(objectMap, "weeksOfTheMonth", s.WeeksOfTheMonth) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduleBasedBackupCriteria. +func (s *ScheduleBasedBackupCriteria) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "absoluteCriteria": + err = unpopulate(val, "AbsoluteCriteria", &s.AbsoluteCriteria) + delete(rawMsg, key) + case "daysOfMonth": + err = unpopulate(val, "DaysOfMonth", &s.DaysOfMonth) + delete(rawMsg, key) + case "daysOfTheWeek": + err = unpopulate(val, "DaysOfTheWeek", &s.DaysOfTheWeek) + delete(rawMsg, key) + case "monthsOfYear": + err = unpopulate(val, "MonthsOfYear", &s.MonthsOfYear) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &s.ObjectType) + delete(rawMsg, key) + case "scheduleTimes": + var aux []*timeRFC3339 + err = unpopulate(val, "ScheduleTimes", &aux) + for _, au := range aux { + s.ScheduleTimes = append(s.ScheduleTimes, (*time.Time)(au)) + } + delete(rawMsg, key) + case "weeksOfTheMonth": + err = unpopulate(val, "WeeksOfTheMonth", &s.WeeksOfTheMonth) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScheduleBasedTriggerContext. +func (s ScheduleBasedTriggerContext) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "ScheduleBasedTriggerContext" + populate(objectMap, "schedule", s.Schedule) + populate(objectMap, "taggingCriteria", s.TaggingCriteria) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduleBasedTriggerContext. +func (s *ScheduleBasedTriggerContext) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &s.ObjectType) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &s.Schedule) + delete(rawMsg, key) + case "taggingCriteria": + err = unpopulate(val, "TaggingCriteria", &s.TaggingCriteria) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecretStoreBasedAuthCredentials. +func (s SecretStoreBasedAuthCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = "SecretStoreBasedAuthCredentials" + populate(objectMap, "secretStoreResource", s.SecretStoreResource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretStoreBasedAuthCredentials. +func (s *SecretStoreBasedAuthCredentials) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &s.ObjectType) + delete(rawMsg, key) + case "secretStoreResource": + err = unpopulate(val, "SecretStoreResource", &s.SecretStoreResource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecretStoreResource. +func (s SecretStoreResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "secretStoreType", s.SecretStoreType) + populate(objectMap, "uri", s.URI) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecretStoreResource. +func (s *SecretStoreResource) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "secretStoreType": + err = unpopulate(val, "SecretStoreType", &s.SecretStoreType) + delete(rawMsg, key) + case "uri": + err = unpopulate(val, "URI", &s.URI) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecuritySettings. +func (s SecuritySettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "immutabilitySettings", s.ImmutabilitySettings) + populate(objectMap, "softDeleteSettings", s.SoftDeleteSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecuritySettings. +func (s *SecuritySettings) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "immutabilitySettings": + err = unpopulate(val, "ImmutabilitySettings", &s.ImmutabilitySettings) + delete(rawMsg, key) + case "softDeleteSettings": + err = unpopulate(val, "SoftDeleteSettings", &s.SoftDeleteSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SoftDeleteSettings. +func (s SoftDeleteSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "retentionDurationInDays", s.RetentionDurationInDays) + populate(objectMap, "state", s.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SoftDeleteSettings. +func (s *SoftDeleteSettings) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "retentionDurationInDays": + err = unpopulate(val, "RetentionDurationInDays", &s.RetentionDurationInDays) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &s.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SourceLifeCycle. +func (s SourceLifeCycle) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deleteAfter", s.DeleteAfter) + populate(objectMap, "sourceDataStore", s.SourceDataStore) + populate(objectMap, "targetDataStoreCopySettings", s.TargetDataStoreCopySettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceLifeCycle. +func (s *SourceLifeCycle) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "deleteAfter": + s.DeleteAfter, err = unmarshalDeleteOptionClassification(val) + delete(rawMsg, key) + case "sourceDataStore": + err = unpopulate(val, "SourceDataStore", &s.SourceDataStore) + delete(rawMsg, key) + case "targetDataStoreCopySettings": + err = unpopulate(val, "TargetDataStoreCopySettings", &s.TargetDataStoreCopySettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StorageSetting. +func (s StorageSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "datastoreType", s.DatastoreType) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageSetting. +func (s *StorageSetting) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "datastoreType": + err = unpopulate(val, "DatastoreType", &s.DatastoreType) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SupportedFeature. +func (s SupportedFeature) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "exposureControlledFeatures", s.ExposureControlledFeatures) + populate(objectMap, "featureName", s.FeatureName) + populate(objectMap, "supportStatus", s.SupportStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SupportedFeature. +func (s *SupportedFeature) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "exposureControlledFeatures": + err = unpopulate(val, "ExposureControlledFeatures", &s.ExposureControlledFeatures) + delete(rawMsg, key) + case "featureName": + err = unpopulate(val, "FeatureName", &s.FeatureName) + delete(rawMsg, key) + case "supportStatus": + err = unpopulate(val, "SupportStatus", &s.SupportStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SyncBackupInstanceRequest. +func (s SyncBackupInstanceRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "syncType", s.SyncType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SyncBackupInstanceRequest. +func (s *SyncBackupInstanceRequest) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "syncType": + err = unpopulate(val, "SyncType", &s.SyncType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TaggingCriteria. +func (t TaggingCriteria) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "criteria", t.Criteria) + populate(objectMap, "isDefault", t.IsDefault) + populate(objectMap, "tagInfo", t.TagInfo) + populate(objectMap, "taggingPriority", t.TaggingPriority) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaggingCriteria. +func (t *TaggingCriteria) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "criteria": + t.Criteria, err = unmarshalBackupCriteriaClassificationArray(val) + delete(rawMsg, key) + case "isDefault": + err = unpopulate(val, "IsDefault", &t.IsDefault) + delete(rawMsg, key) + case "tagInfo": + err = unpopulate(val, "TagInfo", &t.TagInfo) + delete(rawMsg, key) + case "taggingPriority": + err = unpopulate(val, "TaggingPriority", &t.TaggingPriority) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TargetCopySetting. +func (t TargetCopySetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "copyAfter", t.CopyAfter) + populate(objectMap, "dataStore", t.DataStore) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetCopySetting. +func (t *TargetCopySetting) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "copyAfter": + t.CopyAfter, err = unmarshalCopyOptionClassification(val) + delete(rawMsg, key) + case "dataStore": + err = unpopulate(val, "DataStore", &t.DataStore) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TargetDetails. +func (t TargetDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filePrefix", t.FilePrefix) + populate(objectMap, "restoreTargetLocationType", t.RestoreTargetLocationType) + populate(objectMap, "targetResourceArmId", t.TargetResourceArmID) + populate(objectMap, "url", t.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetDetails. +func (t *TargetDetails) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "filePrefix": + err = unpopulate(val, "FilePrefix", &t.FilePrefix) + delete(rawMsg, key) + 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TriggerBackupRequest. +func (t TriggerBackupRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backupRuleOptions", t.BackupRuleOptions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TriggerBackupRequest. +func (t *TriggerBackupRequest) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupRuleOptions": + err = unpopulate(val, "BackupRuleOptions", &t.BackupRuleOptions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TriggerContext. +func (t TriggerContext) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["objectType"] = t.ObjectType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TriggerContext. +func (t *TriggerContext) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "objectType": + err = unpopulate(val, "ObjectType", &t.ObjectType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserFacingError. +func (u UserFacingError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", u.Code) + populate(objectMap, "details", u.Details) + populate(objectMap, "innerError", u.InnerError) + populate(objectMap, "isRetryable", u.IsRetryable) + populate(objectMap, "isUserError", u.IsUserError) + populate(objectMap, "message", u.Message) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "recommendedAction", u.RecommendedAction) + populate(objectMap, "target", u.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserFacingError. +func (u *UserFacingError) 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 "code": + err = unpopulate(val, "Code", &u.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &u.Details) + delete(rawMsg, key) + case "innerError": + err = unpopulate(val, "InnerError", &u.InnerError) + delete(rawMsg, key) + case "isRetryable": + err = unpopulate(val, "IsRetryable", &u.IsRetryable) + delete(rawMsg, key) + case "isUserError": + err = unpopulate(val, "IsUserError", &u.IsUserError) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &u.Message) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "recommendedAction": + err = unpopulate(val, "RecommendedAction", &u.RecommendedAction) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &u.Target) + 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 ValidateForBackupRequest. +func (v ValidateForBackupRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backupInstance", v.BackupInstance) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateForBackupRequest. +func (v *ValidateForBackupRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupInstance": + err = unpopulate(val, "BackupInstance", &v.BackupInstance) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ValidateRestoreRequestObject. +func (v ValidateRestoreRequestObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "restoreRequestObject", v.RestoreRequestObject) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateRestoreRequestObject. +func (v *ValidateRestoreRequestObject) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "restoreRequestObject": + v.RestoreRequestObject, err = unmarshalAzureBackupRestoreRequestClassification(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationresult_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client.go similarity index 95% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationresult_client.go rename to sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client.go index ae4b2f78577b..1cb27507b8b0 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationresult_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client.go @@ -5,6 +5,7 @@ // 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 @@ -32,7 +33,7 @@ type OperationResultClient struct { } // NewOperationResultClient creates a new instance of OperationResultClient with the specified values. -// subscriptionID - The subscription Id. +// 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) { @@ -57,7 +58,7 @@ 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-04-01 +// Generated from API version 2022-12-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) @@ -77,9 +78,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") @@ -94,7 +92,7 @@ func (client *OperationResultClient) getCreateRequest(ctx context.Context, opera return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operations_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/operations_client.go similarity index 96% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operations_client.go rename to sdk/resourcemanager/dataprotection/armdataprotection/operations_client.go index 081476f84e0f..d82326856964 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operations_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/operations_client.go @@ -5,6 +5,7 @@ // 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 @@ -49,8 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Returns the list of available operations. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 +// Generated from API version 2022-12-01 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -88,7 +88,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatus_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client.go similarity index 94% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatus_client.go rename to sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client.go index 322b0ea0af26..17c8d4f50191 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatus_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client.go @@ -5,6 +5,7 @@ // 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 @@ -31,7 +32,7 @@ type OperationStatusClient struct { } // NewOperationStatusClient creates a new instance of OperationStatusClient with the specified values. -// subscriptionID - The subscription Id. +// 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) { @@ -56,7 +57,7 @@ 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-04-01 +// Generated from API version 2022-12-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) @@ -76,9 +77,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") @@ -93,7 +91,7 @@ func (client *OperationStatusClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatusbackupvaultcontext_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client.go similarity index 93% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatusbackupvaultcontext_client.go rename to sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client.go index ce13d838ec65..21bcb9e2a273 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatusbackupvaultcontext_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client.go @@ -5,6 +5,7 @@ // 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 @@ -31,7 +32,7 @@ type OperationStatusBackupVaultContextClient struct { } // NewOperationStatusBackupVaultContextClient creates a new instance of OperationStatusBackupVaultContextClient with the specified values. -// subscriptionID - The subscription Id. +// 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) { @@ -56,8 +57,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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. @@ -79,9 +80,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") @@ -100,7 +98,7 @@ func (client *OperationStatusBackupVaultContextClient) getCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatusresourcegroupcontext_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client.go similarity index 93% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatusresourcegroupcontext_client.go rename to sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client.go index c8392587c7f1..474daf815c9f 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_operationstatusresourcegroupcontext_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client.go @@ -5,6 +5,7 @@ // 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 @@ -31,7 +32,7 @@ type OperationStatusResourceGroupContextClient struct { } // NewOperationStatusResourceGroupContextClient creates a new instance of OperationStatusResourceGroupContextClient with the specified values. -// subscriptionID - The subscription Id. +// 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) { @@ -56,8 +57,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -82,9 +83,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") @@ -95,7 +93,7 @@ func (client *OperationStatusResourceGroupContextClient) getCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/dataprotection/armdataprotection/polymorphic_helpers.go similarity index 99% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_polymorphic_helpers.go rename to sdk/resourcemanager/dataprotection/armdataprotection/polymorphic_helpers.go index d1bce9802899..80f1bd57223c 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/polymorphic_helpers.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_recoverypoints_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client.go similarity index 91% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_recoverypoints_client.go rename to sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client.go index 1752537c5f65..a1f920c38a81 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_recoverypoints_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client.go @@ -5,6 +5,7 @@ // 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 @@ -31,7 +32,7 @@ type RecoveryPointsClient struct { } // NewRecoveryPointsClient creates a new instance of RecoveryPointsClient with the specified values. -// subscriptionID - The subscription Id. +// 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) { @@ -56,10 +57,10 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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 +// 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) @@ -79,9 +80,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") @@ -104,7 +102,7 @@ func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -120,11 +118,10 @@ func (client *RecoveryPointsClient) getHandleResponse(resp *http.Response) (Reco } // NewListPager - Returns a list of Recovery Points for a DataSource in a vault. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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 +// backupInstanceName - The name of the backup instance. // options - RecoveryPointsClientListOptions contains the optional parameters for the RecoveryPointsClient.List method. func (client *RecoveryPointsClient) NewListPager(resourceGroupName string, vaultName string, backupInstanceName string, options *RecoveryPointsClientListOptions) *runtime.Pager[RecoveryPointsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[RecoveryPointsClientListResponse]{ @@ -157,9 +154,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 +172,7 @@ func (client *RecoveryPointsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_resourceguards_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client.go similarity index 91% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_resourceguards_client.go rename to sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client.go index 27276fa5b7fb..780f516919b7 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_resourceguards_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client.go @@ -5,6 +5,7 @@ // 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 @@ -31,7 +32,7 @@ type ResourceGuardsClient struct { } // NewResourceGuardsClient creates a new instance of ResourceGuardsClient with the specified values. -// subscriptionID - The subscription Id. +// 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) { @@ -56,8 +57,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -82,9 +83,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") @@ -95,7 +93,7 @@ func (client *ResourceGuardsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -103,8 +101,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -129,9 +127,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") @@ -142,7 +137,7 @@ func (client *ResourceGuardsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -159,9 +154,8 @@ 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. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. // options - ResourceGuardsClientGetBackupSecurityPINRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetBackupSecurityPINRequestsObjects // method. func (client *ResourceGuardsClient) NewGetBackupSecurityPINRequestsObjectsPager(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetBackupSecurityPINRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse] { @@ -199,9 +193,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 +203,7 @@ func (client *ResourceGuardsClient) getBackupSecurityPINRequestsObjectsCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -230,8 +221,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -256,9 +247,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 +261,7 @@ func (client *ResourceGuardsClient) getDefaultBackupSecurityPINRequestsObjectCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -291,8 +279,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -317,9 +305,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 +319,7 @@ func (client *ResourceGuardsClient) getDefaultDeleteProtectedItemRequestsObjectC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -352,8 +337,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -378,9 +363,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 +377,7 @@ func (client *ResourceGuardsClient) getDefaultDeleteResourceGuardProxyRequestsOb return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -413,8 +395,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -439,9 +421,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 +435,7 @@ func (client *ResourceGuardsClient) getDefaultDisableSoftDeleteRequestsObjectCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -474,8 +453,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -500,9 +479,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 +493,7 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectedItemRequestsObjectC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -535,8 +511,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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) { @@ -561,9 +537,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 +551,7 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectionPolicyRequestsObje return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -595,9 +568,8 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectionPolicyRequestsObje // NewGetDeleteProtectedItemRequestsObjectsPager - 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. // options - ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetDeleteProtectedItemRequestsObjects // method. func (client *ResourceGuardsClient) NewGetDeleteProtectedItemRequestsObjectsPager(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse] { @@ -635,9 +607,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") @@ -648,7 +617,7 @@ func (client *ResourceGuardsClient) getDeleteProtectedItemRequestsObjectsCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -665,9 +634,8 @@ func (client *ResourceGuardsClient) getDeleteProtectedItemRequestsObjectsHandleR // NewGetDeleteResourceGuardProxyRequestsObjectsPager - 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. // options - ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsOptions contains the optional parameters for the // ResourceGuardsClient.GetDeleteResourceGuardProxyRequestsObjects method. func (client *ResourceGuardsClient) NewGetDeleteResourceGuardProxyRequestsObjectsPager(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse] { @@ -705,9 +673,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") @@ -718,7 +683,7 @@ func (client *ResourceGuardsClient) getDeleteResourceGuardProxyRequestsObjectsCr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -735,9 +700,8 @@ func (client *ResourceGuardsClient) getDeleteResourceGuardProxyRequestsObjectsHa // NewGetDisableSoftDeleteRequestsObjectsPager - 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. // options - ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetDisableSoftDeleteRequestsObjects // method. func (client *ResourceGuardsClient) NewGetDisableSoftDeleteRequestsObjectsPager(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse] { @@ -775,9 +739,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") @@ -788,7 +749,7 @@ func (client *ResourceGuardsClient) getDisableSoftDeleteRequestsObjectsCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -804,9 +765,8 @@ func (client *ResourceGuardsClient) getDisableSoftDeleteRequestsObjectsHandleRes } // NewGetResourcesInResourceGroupPager - Returns ResourceGuards collection belonging to a ResourceGroup. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. // options - ResourceGuardsClientGetResourcesInResourceGroupOptions contains the optional parameters for the ResourceGuardsClient.GetResourcesInResourceGroup // method. func (client *ResourceGuardsClient) NewGetResourcesInResourceGroupPager(resourceGroupName string, options *ResourceGuardsClientGetResourcesInResourceGroupOptions) *runtime.Pager[ResourceGuardsClientGetResourcesInResourceGroupResponse] { @@ -840,9 +800,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") @@ -853,7 +810,7 @@ func (client *ResourceGuardsClient) getResourcesInResourceGroupCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -869,8 +826,7 @@ func (client *ResourceGuardsClient) getResourcesInResourceGroupHandleResponse(re } // NewGetResourcesInSubscriptionPager - Returns ResourceGuards collection belonging to a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 +// Generated from API version 2022-12-01 // options - ResourceGuardsClientGetResourcesInSubscriptionOptions contains the optional parameters for the ResourceGuardsClient.GetResourcesInSubscription // method. func (client *ResourceGuardsClient) NewGetResourcesInSubscriptionPager(options *ResourceGuardsClientGetResourcesInSubscriptionOptions) *runtime.Pager[ResourceGuardsClientGetResourcesInSubscriptionResponse] { @@ -904,16 +860,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-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -930,9 +883,8 @@ func (client *ResourceGuardsClient) getResourcesInSubscriptionHandleResponse(res // NewGetUpdateProtectedItemRequestsObjectsPager - 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. // options - ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.GetUpdateProtectedItemRequestsObjects // method. func (client *ResourceGuardsClient) NewGetUpdateProtectedItemRequestsObjectsPager(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse] { @@ -970,9 +922,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") @@ -983,7 +932,7 @@ func (client *ResourceGuardsClient) getUpdateProtectedItemRequestsObjectsCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1000,9 +949,8 @@ func (client *ResourceGuardsClient) getUpdateProtectedItemRequestsObjectsHandleR // NewGetUpdateProtectionPolicyRequestsObjectsPager - 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-01 +// resourceGroupName - The name of the resource group. The name is case insensitive. // options - ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsOptions contains the optional parameters for the // ResourceGuardsClient.GetUpdateProtectionPolicyRequestsObjects method. func (client *ResourceGuardsClient) NewGetUpdateProtectionPolicyRequestsObjectsPager(resourceGroupName string, resourceGuardsName string, options *ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsOptions) *runtime.Pager[ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse] { @@ -1040,9 +988,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") @@ -1053,7 +998,7 @@ func (client *ResourceGuardsClient) getUpdateProtectionPolicyRequestsObjectsCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1070,12 +1015,12 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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 PatchResourceRequestInput, options *ResourceGuardsClientPatchOptions) (ResourceGuardsClientPatchResponse, error) { +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 @@ -1091,15 +1036,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") @@ -1110,7 +1052,7 @@ func (client *ResourceGuardsClient) patchCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -1127,8 +1069,8 @@ 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-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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. @@ -1154,9 +1096,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") @@ -1167,7 +1106,7 @@ func (client *ResourceGuardsClient) putCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-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/zz_generated_response_types.go b/sdk/resourcemanager/dataprotection/armdataprotection/response_types.go similarity index 95% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_response_types.go rename to sdk/resourcemanager/dataprotection/armdataprotection/response_types.go index 0f419420f600..e9657db37ff4 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_response_types.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/response_types.go @@ -5,6 +5,7 @@ // 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 @@ -166,6 +167,21 @@ func (c *ClientCheckFeatureSupportResponse) UnmarshalJSON(data []byte) error { return nil } +// DeletedBackupInstancesClientGetResponse contains the response from method DeletedBackupInstancesClient.Get. +type DeletedBackupInstancesClientGetResponse struct { + DeletedBackupInstanceResource +} + +// DeletedBackupInstancesClientListResponse contains the response from method DeletedBackupInstancesClient.List. +type DeletedBackupInstancesClientListResponse struct { + DeletedBackupInstanceResourceList +} + +// DeletedBackupInstancesClientUndeleteResponse contains the response from method DeletedBackupInstancesClient.Undelete. +type DeletedBackupInstancesClientUndeleteResponse struct { + // placeholder for future response values +} + // ExportJobsClientTriggerResponse contains the response from method ExportJobsClient.Trigger. type ExportJobsClientTriggerResponse struct { // placeholder for future response values diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_restorabletimeranges_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client.go similarity index 92% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_restorabletimeranges_client.go rename to sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client.go index 571aff923406..cbb20d538ad2 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_restorabletimeranges_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client.go @@ -5,6 +5,7 @@ // 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 @@ -31,7 +32,7 @@ type RestorableTimeRangesClient struct { } // NewRestorableTimeRangesClient creates a new instance of RestorableTimeRangesClient with the specified values. -// subscriptionID - The subscription Id. +// 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) { @@ -56,10 +57,10 @@ func NewRestorableTimeRangesClient(subscriptionID string, credential azcore.Toke // Find - // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-04-01 -// resourceGroupName - The name of the resource group where the backup vault is present. +// Generated from API version 2022-12-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 +// backupInstanceName - The name of the backup instance. // parameters - Request body for operation // options - RestorableTimeRangesClientFindOptions contains the optional parameters for the RestorableTimeRangesClient.Find // method. @@ -81,9 +82,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") @@ -102,7 +100,7 @@ func (client *RestorableTimeRangesClient) findCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-04-01") + reqQP.Set("api-version", "2022-12-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/zz_generated_time_rfc3339.go b/sdk/resourcemanager/dataprotection/armdataprotection/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/dataprotection/armdataprotection/time_rfc3339.go index bb950e77194f..c98824f86dfa 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/time_rfc3339.go @@ -5,6 +5,7 @@ // 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 diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupinstances_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupinstances_client_test.go deleted file mode 100644 index a828da77c85c..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupinstances_client_test.go +++ /dev/null @@ -1,567 +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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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{ - 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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/examples/BackupInstanceOperations/TriggerRestore.json -func ExampleBackupInstancesClient_BeginTriggerRestore() { - 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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/ze_generated_example_backuppolicies_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backuppolicies_client_test.go deleted file mode 100644 index 3cdcf01d9068..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backuppolicies_client_test.go +++ /dev/null @@ -1,195 +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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/ze_generated_example_backupvaultoperationresults_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupvaultoperationresults_client_test.go deleted file mode 100644 index 983dc270ed18..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupvaultoperationresults_client_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/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-04-01/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/ze_generated_example_backupvaults_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupvaults_client_test.go deleted file mode 100644 index 987b5a05f62f..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_backupvaults_client_test.go +++ /dev/null @@ -1,220 +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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/examples/VaultCRUD/GetBackupVault.json -func ExampleBackupVaultsClient_Get() { - 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/stable/2022-04-01/examples/VaultCRUD/PutBackupVault.json -func ExampleBackupVaultsClient_BeginCreateOrUpdate() { - 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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/ze_generated_example_dataprotection_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_dataprotection_client_test.go deleted file mode 100644 index 3e171928b211..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_dataprotection_client_test.go +++ /dev/null @@ -1,43 +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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-04-01/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/ze_generated_example_dataprotectionoperations_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_dataprotectionoperations_client_test.go deleted file mode 100644 index ac7f6ad313a5..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_dataprotectionoperations_client_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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-04-01/examples/Operations/List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := 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/ze_generated_example_exportjobs_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_exportjobs_client_test.go deleted file mode 100644 index 2410b3dd4242..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_exportjobs_client_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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-04-01/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/ze_generated_example_exportjobsoperationresult_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_exportjobsoperationresult_client_test.go deleted file mode 100644 index 93d5b27f899d..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_exportjobsoperationresult_client_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/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-04-01/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/ze_generated_example_jobs_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_jobs_client_test.go deleted file mode 100644 index 49ab2a2f354d..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_jobs_client_test.go +++ /dev/null @@ -1,66 +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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-04-01/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/stable/2022-04-01/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/ze_generated_example_operationresult_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_operationresult_client_test.go deleted file mode 100644 index 0097c028d54d..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_operationresult_client_test.go +++ /dev/null @@ -1,39 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-04-01/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/ze_generated_example_operationstatus_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_operationstatus_client_test.go deleted file mode 100644 index 5f8ad66a4dda..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_operationstatus_client_test.go +++ /dev/null @@ -1,39 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-04-01/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/ze_generated_example_operationstatusbackupvaultcontext_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_operationstatusbackupvaultcontext_client_test.go deleted file mode 100644 index a3a26fe1f16d..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_operationstatusbackupvaultcontext_client_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/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-04-01/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/ze_generated_example_operationstatusresourcegroupcontext_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_operationstatusresourcegroupcontext_client_test.go deleted file mode 100644 index 1ff5d9125e85..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_operationstatusresourcegroupcontext_client_test.go +++ /dev/null @@ -1,39 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-04-01/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/ze_generated_example_recoverypoints_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_recoverypoints_client_test.go deleted file mode 100644 index fd377585ed40..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_recoverypoints_client_test.go +++ /dev/null @@ -1,70 +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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-04-01/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/stable/2022-04-01/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/ze_generated_example_resourceguards_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_resourceguards_client_test.go deleted file mode 100644 index 87088c4fe1cb..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_resourceguards_client_test.go +++ /dev/null @@ -1,458 +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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/stable/2022-04-01/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/ze_generated_example_restorabletimeranges_client_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_restorabletimeranges_client_test.go deleted file mode 100644 index e63a9cad72d1..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/ze_generated_example_restorabletimeranges_client_test.go +++ /dev/null @@ -1,46 +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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-04-01/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/zz_generated_models_serde.go b/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_models_serde.go deleted file mode 100644 index e2fa71122ccc..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/zz_generated_models_serde.go +++ /dev/null @@ -1,1834 +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 - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) - -// MarshalJSON implements the json.Marshaller interface for type AbsoluteDeleteOption. -func (a AbsoluteDeleteOption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "duration", a.Duration) - objectMap["objectType"] = "AbsoluteDeleteOption" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AbsoluteDeleteOption. -func (a *AbsoluteDeleteOption) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "duration": - err = unpopulate(val, "Duration", &a.Duration) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AdhocBasedTriggerContext. -func (a AdhocBasedTriggerContext) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "AdhocBasedTriggerContext" - populate(objectMap, "taggingCriteria", a.TaggingCriteria) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AdhocBasedTriggerContext. -func (a *AdhocBasedTriggerContext) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "taggingCriteria": - err = unpopulate(val, "TaggingCriteria", &a.TaggingCriteria) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupDiscreteRecoveryPoint. -func (a AzureBackupDiscreteRecoveryPoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "friendlyName", a.FriendlyName) - objectMap["objectType"] = "AzureBackupDiscreteRecoveryPoint" - populate(objectMap, "policyName", a.PolicyName) - populate(objectMap, "policyVersion", a.PolicyVersion) - populate(objectMap, "recoveryPointDataStoresDetails", a.RecoveryPointDataStoresDetails) - populate(objectMap, "recoveryPointId", a.RecoveryPointID) - populateTimeRFC3339(objectMap, "recoveryPointTime", a.RecoveryPointTime) - populate(objectMap, "recoveryPointType", a.RecoveryPointType) - populate(objectMap, "retentionTagName", a.RetentionTagName) - populate(objectMap, "retentionTagVersion", a.RetentionTagVersion) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupDiscreteRecoveryPoint. -func (a *AzureBackupDiscreteRecoveryPoint) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "friendlyName": - err = unpopulate(val, "FriendlyName", &a.FriendlyName) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &a.PolicyName) - delete(rawMsg, key) - case "policyVersion": - err = unpopulate(val, "PolicyVersion", &a.PolicyVersion) - delete(rawMsg, key) - case "recoveryPointDataStoresDetails": - err = unpopulate(val, "RecoveryPointDataStoresDetails", &a.RecoveryPointDataStoresDetails) - delete(rawMsg, key) - case "recoveryPointId": - err = unpopulate(val, "RecoveryPointID", &a.RecoveryPointID) - delete(rawMsg, key) - case "recoveryPointTime": - err = unpopulateTimeRFC3339(val, "RecoveryPointTime", &a.RecoveryPointTime) - delete(rawMsg, key) - case "recoveryPointType": - err = unpopulate(val, "RecoveryPointType", &a.RecoveryPointType) - delete(rawMsg, key) - case "retentionTagName": - err = unpopulate(val, "RetentionTagName", &a.RetentionTagName) - delete(rawMsg, key) - case "retentionTagVersion": - err = unpopulate(val, "RetentionTagVersion", &a.RetentionTagVersion) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupFindRestorableTimeRangesResponse. -func (a AzureBackupFindRestorableTimeRangesResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "objectType", a.ObjectType) - populate(objectMap, "restorableTimeRanges", a.RestorableTimeRanges) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupJob. -func (a AzureBackupJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "activityID", a.ActivityID) - populate(objectMap, "backupInstanceFriendlyName", a.BackupInstanceFriendlyName) - populate(objectMap, "backupInstanceId", a.BackupInstanceID) - populate(objectMap, "dataSourceId", a.DataSourceID) - populate(objectMap, "dataSourceLocation", a.DataSourceLocation) - populate(objectMap, "dataSourceName", a.DataSourceName) - populate(objectMap, "dataSourceSetName", a.DataSourceSetName) - populate(objectMap, "dataSourceType", a.DataSourceType) - populate(objectMap, "destinationDataStoreName", a.DestinationDataStoreName) - populate(objectMap, "duration", a.Duration) - populateTimeRFC3339(objectMap, "endTime", a.EndTime) - populate(objectMap, "errorDetails", a.ErrorDetails) - populate(objectMap, "etag", a.Etag) - populate(objectMap, "extendedInfo", a.ExtendedInfo) - populate(objectMap, "isUserTriggered", a.IsUserTriggered) - populate(objectMap, "operation", a.Operation) - populate(objectMap, "operationCategory", a.OperationCategory) - populate(objectMap, "policyId", a.PolicyID) - populate(objectMap, "policyName", a.PolicyName) - populate(objectMap, "progressEnabled", a.ProgressEnabled) - populate(objectMap, "progressUrl", a.ProgressURL) - populate(objectMap, "restoreType", a.RestoreType) - populate(objectMap, "sourceDataStoreName", a.SourceDataStoreName) - populate(objectMap, "sourceResourceGroup", a.SourceResourceGroup) - populate(objectMap, "sourceSubscriptionID", a.SourceSubscriptionID) - populateTimeRFC3339(objectMap, "startTime", a.StartTime) - populate(objectMap, "status", a.Status) - populate(objectMap, "subscriptionId", a.SubscriptionID) - populate(objectMap, "supportedActions", a.SupportedActions) - populate(objectMap, "vaultName", a.VaultName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupJob. -func (a *AzureBackupJob) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "activityID": - err = unpopulate(val, "ActivityID", &a.ActivityID) - delete(rawMsg, key) - case "backupInstanceFriendlyName": - err = unpopulate(val, "BackupInstanceFriendlyName", &a.BackupInstanceFriendlyName) - delete(rawMsg, key) - case "backupInstanceId": - err = unpopulate(val, "BackupInstanceID", &a.BackupInstanceID) - delete(rawMsg, key) - case "dataSourceId": - err = unpopulate(val, "DataSourceID", &a.DataSourceID) - delete(rawMsg, key) - case "dataSourceLocation": - err = unpopulate(val, "DataSourceLocation", &a.DataSourceLocation) - delete(rawMsg, key) - case "dataSourceName": - err = unpopulate(val, "DataSourceName", &a.DataSourceName) - delete(rawMsg, key) - case "dataSourceSetName": - err = unpopulate(val, "DataSourceSetName", &a.DataSourceSetName) - delete(rawMsg, key) - case "dataSourceType": - err = unpopulate(val, "DataSourceType", &a.DataSourceType) - delete(rawMsg, key) - case "destinationDataStoreName": - err = unpopulate(val, "DestinationDataStoreName", &a.DestinationDataStoreName) - delete(rawMsg, key) - case "duration": - err = unpopulate(val, "Duration", &a.Duration) - delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &a.EndTime) - delete(rawMsg, key) - case "errorDetails": - err = unpopulate(val, "ErrorDetails", &a.ErrorDetails) - delete(rawMsg, key) - case "etag": - err = unpopulate(val, "Etag", &a.Etag) - delete(rawMsg, key) - case "extendedInfo": - err = unpopulate(val, "ExtendedInfo", &a.ExtendedInfo) - delete(rawMsg, key) - case "isUserTriggered": - err = unpopulate(val, "IsUserTriggered", &a.IsUserTriggered) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &a.Operation) - delete(rawMsg, key) - case "operationCategory": - err = unpopulate(val, "OperationCategory", &a.OperationCategory) - delete(rawMsg, key) - case "policyId": - err = unpopulate(val, "PolicyID", &a.PolicyID) - delete(rawMsg, key) - case "policyName": - err = unpopulate(val, "PolicyName", &a.PolicyName) - delete(rawMsg, key) - case "progressEnabled": - err = unpopulate(val, "ProgressEnabled", &a.ProgressEnabled) - delete(rawMsg, key) - case "progressUrl": - err = unpopulate(val, "ProgressURL", &a.ProgressURL) - delete(rawMsg, key) - case "restoreType": - err = unpopulate(val, "RestoreType", &a.RestoreType) - delete(rawMsg, key) - case "sourceDataStoreName": - err = unpopulate(val, "SourceDataStoreName", &a.SourceDataStoreName) - delete(rawMsg, key) - case "sourceResourceGroup": - err = unpopulate(val, "SourceResourceGroup", &a.SourceResourceGroup) - delete(rawMsg, key) - case "sourceSubscriptionID": - err = unpopulate(val, "SourceSubscriptionID", &a.SourceSubscriptionID) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &a.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &a.Status) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, "SubscriptionID", &a.SubscriptionID) - delete(rawMsg, key) - case "supportedActions": - err = unpopulate(val, "SupportedActions", &a.SupportedActions) - delete(rawMsg, key) - case "vaultName": - err = unpopulate(val, "VaultName", &a.VaultName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupParams. -func (a AzureBackupParams) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "backupType", a.BackupType) - objectMap["objectType"] = "AzureBackupParams" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupParams. -func (a *AzureBackupParams) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupType": - err = unpopulate(val, "BackupType", &a.BackupType) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryPointBasedRestoreRequest. -func (a AzureBackupRecoveryPointBasedRestoreRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "AzureBackupRecoveryPointBasedRestoreRequest" - populate(objectMap, "recoveryPointId", a.RecoveryPointID) - populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) - populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRecoveryPointBasedRestoreRequest. -func (a *AzureBackupRecoveryPointBasedRestoreRequest) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "recoveryPointId": - err = unpopulate(val, "RecoveryPointID", &a.RecoveryPointID) - delete(rawMsg, key) - case "restoreTargetInfo": - a.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val) - delete(rawMsg, key) - case "sourceDataStoreType": - err = unpopulate(val, "SourceDataStoreType", &a.SourceDataStoreType) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryPointResource. -func (a AzureBackupRecoveryPointResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRecoveryPointResource. -func (a *AzureBackupRecoveryPointResource) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - a.Properties, err = unmarshalAzureBackupRecoveryPointClassification(val) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupRecoveryTimeBasedRestoreRequest. -func (a AzureBackupRecoveryTimeBasedRestoreRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "AzureBackupRecoveryTimeBasedRestoreRequest" - populate(objectMap, "recoveryPointTime", a.RecoveryPointTime) - populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) - populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRecoveryTimeBasedRestoreRequest. -func (a *AzureBackupRecoveryTimeBasedRestoreRequest) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "recoveryPointTime": - err = unpopulate(val, "RecoveryPointTime", &a.RecoveryPointTime) - delete(rawMsg, key) - case "restoreTargetInfo": - a.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val) - delete(rawMsg, key) - case "sourceDataStoreType": - err = unpopulate(val, "SourceDataStoreType", &a.SourceDataStoreType) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupRestoreRequest. -func (a AzureBackupRestoreRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = a.ObjectType - populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) - populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRestoreRequest. -func (a *AzureBackupRestoreRequest) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "restoreTargetInfo": - a.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val) - delete(rawMsg, key) - case "sourceDataStoreType": - err = unpopulate(val, "SourceDataStoreType", &a.SourceDataStoreType) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupRestoreWithRehydrationRequest. -func (a AzureBackupRestoreWithRehydrationRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "AzureBackupRestoreWithRehydrationRequest" - populate(objectMap, "recoveryPointId", a.RecoveryPointID) - populate(objectMap, "rehydrationPriority", a.RehydrationPriority) - populate(objectMap, "rehydrationRetentionDuration", a.RehydrationRetentionDuration) - populate(objectMap, "restoreTargetInfo", a.RestoreTargetInfo) - populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) - populate(objectMap, "sourceResourceId", a.SourceResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRestoreWithRehydrationRequest. -func (a *AzureBackupRestoreWithRehydrationRequest) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "recoveryPointId": - err = unpopulate(val, "RecoveryPointID", &a.RecoveryPointID) - delete(rawMsg, key) - case "rehydrationPriority": - err = unpopulate(val, "RehydrationPriority", &a.RehydrationPriority) - delete(rawMsg, key) - case "rehydrationRetentionDuration": - err = unpopulate(val, "RehydrationRetentionDuration", &a.RehydrationRetentionDuration) - delete(rawMsg, key) - case "restoreTargetInfo": - a.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val) - delete(rawMsg, key) - case "sourceDataStoreType": - err = unpopulate(val, "SourceDataStoreType", &a.SourceDataStoreType) - delete(rawMsg, key) - case "sourceResourceId": - err = unpopulate(val, "SourceResourceID", &a.SourceResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureBackupRule. -func (a AzureBackupRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "backupParameters", a.BackupParameters) - populate(objectMap, "dataStore", a.DataStore) - populate(objectMap, "name", a.Name) - objectMap["objectType"] = "AzureBackupRule" - populate(objectMap, "trigger", a.Trigger) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupRule. -func (a *AzureBackupRule) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "backupParameters": - a.BackupParameters, err = unmarshalBackupParametersClassification(val) - delete(rawMsg, key) - case "dataStore": - err = unpopulate(val, "DataStore", &a.DataStore) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "trigger": - a.Trigger, err = unmarshalTriggerContextClassification(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureOperationalStoreParameters. -func (a AzureOperationalStoreParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dataStoreType", a.DataStoreType) - objectMap["objectType"] = "AzureOperationalStoreParameters" - populate(objectMap, "resourceGroupId", a.ResourceGroupID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureOperationalStoreParameters. -func (a *AzureOperationalStoreParameters) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataStoreType": - err = unpopulate(val, "DataStoreType", &a.DataStoreType) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - case "resourceGroupId": - err = unpopulate(val, "ResourceGroupID", &a.ResourceGroupID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureRetentionRule. -func (a AzureRetentionRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "isDefault", a.IsDefault) - populate(objectMap, "lifecycles", a.Lifecycles) - populate(objectMap, "name", a.Name) - objectMap["objectType"] = "AzureRetentionRule" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureRetentionRule. -func (a *AzureRetentionRule) 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", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "isDefault": - err = unpopulate(val, "IsDefault", &a.IsDefault) - delete(rawMsg, key) - case "lifecycles": - err = unpopulate(val, "Lifecycles", &a.Lifecycles) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &a.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupInstance. -func (b BackupInstance) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "currentProtectionState", b.CurrentProtectionState) - populate(objectMap, "dataSourceInfo", b.DataSourceInfo) - populate(objectMap, "dataSourceSetInfo", b.DataSourceSetInfo) - populate(objectMap, "datasourceAuthCredentials", b.DatasourceAuthCredentials) - populate(objectMap, "friendlyName", b.FriendlyName) - populate(objectMap, "objectType", b.ObjectType) - populate(objectMap, "policyInfo", b.PolicyInfo) - populate(objectMap, "protectionErrorDetails", b.ProtectionErrorDetails) - populate(objectMap, "protectionStatus", b.ProtectionStatus) - populate(objectMap, "provisioningState", b.ProvisioningState) - populate(objectMap, "validationType", b.ValidationType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupInstance. -func (b *BackupInstance) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "currentProtectionState": - err = unpopulate(val, "CurrentProtectionState", &b.CurrentProtectionState) - delete(rawMsg, key) - case "dataSourceInfo": - err = unpopulate(val, "DataSourceInfo", &b.DataSourceInfo) - delete(rawMsg, key) - case "dataSourceSetInfo": - err = unpopulate(val, "DataSourceSetInfo", &b.DataSourceSetInfo) - delete(rawMsg, key) - case "datasourceAuthCredentials": - b.DatasourceAuthCredentials, err = unmarshalAuthCredentialsClassification(val) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &b.FriendlyName) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &b.ObjectType) - delete(rawMsg, key) - case "policyInfo": - err = unpopulate(val, "PolicyInfo", &b.PolicyInfo) - delete(rawMsg, key) - case "protectionErrorDetails": - err = unpopulate(val, "ProtectionErrorDetails", &b.ProtectionErrorDetails) - delete(rawMsg, key) - case "protectionStatus": - err = unpopulate(val, "ProtectionStatus", &b.ProtectionStatus) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &b.ProvisioningState) - delete(rawMsg, key) - case "validationType": - err = unpopulate(val, "ValidationType", &b.ValidationType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupPolicy. -func (b BackupPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "datasourceTypes", b.DatasourceTypes) - objectMap["objectType"] = "BackupPolicy" - populate(objectMap, "policyRules", b.PolicyRules) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupPolicy. -func (b *BackupPolicy) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "datasourceTypes": - err = unpopulate(val, "DatasourceTypes", &b.DatasourceTypes) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &b.ObjectType) - delete(rawMsg, key) - case "policyRules": - b.PolicyRules, err = unmarshalBasePolicyRuleClassificationArray(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BackupSchedule. -func (b BackupSchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "repeatingTimeIntervals", b.RepeatingTimeIntervals) - populate(objectMap, "timeZone", b.TimeZone) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type BackupVault. -func (b BackupVault) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "monitoringSettings", b.MonitoringSettings) - populate(objectMap, "provisioningState", b.ProvisioningState) - populate(objectMap, "resourceMoveDetails", b.ResourceMoveDetails) - populate(objectMap, "resourceMoveState", b.ResourceMoveState) - populate(objectMap, "storageSettings", b.StorageSettings) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type BackupVaultResource. -func (b BackupVaultResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "eTag", b.ETag) - populate(objectMap, "id", b.ID) - populate(objectMap, "identity", b.Identity) - populate(objectMap, "location", b.Location) - populate(objectMap, "name", b.Name) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "systemData", b.SystemData) - populate(objectMap, "tags", b.Tags) - populate(objectMap, "type", b.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type BaseBackupPolicy. -func (b BaseBackupPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "datasourceTypes", b.DatasourceTypes) - objectMap["objectType"] = b.ObjectType - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type BaseBackupPolicyResource. -func (b BaseBackupPolicyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", b.ID) - populate(objectMap, "name", b.Name) - populate(objectMap, "properties", b.Properties) - populate(objectMap, "systemData", b.SystemData) - populate(objectMap, "type", b.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BaseBackupPolicyResource. -func (b *BaseBackupPolicyResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &b.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) - delete(rawMsg, key) - case "properties": - b.Properties, err = unmarshalBaseBackupPolicyClassification(val) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &b.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &b.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CopyOnExpiryOption. -func (c CopyOnExpiryOption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "CopyOnExpiryOption" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CopyOnExpiryOption. -func (c *CopyOnExpiryOption) 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 "objectType": - err = unpopulate(val, "ObjectType", &c.ObjectType) - 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{}) - populate(objectMap, "duration", c.Duration) - objectMap["objectType"] = "CustomCopyOption" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomCopyOption. -func (c *CustomCopyOption) 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 "duration": - err = unpopulate(val, "Duration", &c.Duration) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &c.ObjectType) - 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 DppTrackedResource. -func (d DppTrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "eTag", d.ETag) - populate(objectMap, "id", d.ID) - populate(objectMap, "identity", d.Identity) - 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) -} - -// MarshalJSON implements the json.Marshaller interface for type FeatureValidationRequest. -func (f FeatureValidationRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "featureName", f.FeatureName) - populate(objectMap, "featureType", f.FeatureType) - objectMap["objectType"] = "FeatureValidationRequest" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FeatureValidationRequest. -func (f *FeatureValidationRequest) 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 "featureName": - err = unpopulate(val, "FeatureName", &f.FeatureName) - delete(rawMsg, key) - case "featureType": - err = unpopulate(val, "FeatureType", &f.FeatureType) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &f.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FeatureValidationResponse. -func (f *FeatureValidationResponse) 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 "featureType": - err = unpopulate(val, "FeatureType", &f.FeatureType) - delete(rawMsg, key) - case "features": - err = unpopulate(val, "Features", &f.Features) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &f.ObjectType) - 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 ImmediateCopyOption. -func (i ImmediateCopyOption) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "ImmediateCopyOption" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ImmediateCopyOption. -func (i *ImmediateCopyOption) 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", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &i.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InnerError. -func (i InnerError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalInfo", i.AdditionalInfo) - populate(objectMap, "code", i.Code) - populate(objectMap, "embeddedInnerError", i.EmbeddedInnerError) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ItemLevelRestoreTargetInfo. -func (i ItemLevelRestoreTargetInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "datasourceAuthCredentials", i.DatasourceAuthCredentials) - populate(objectMap, "datasourceInfo", i.DatasourceInfo) - populate(objectMap, "datasourceSetInfo", i.DatasourceSetInfo) - objectMap["objectType"] = "ItemLevelRestoreTargetInfo" - populate(objectMap, "recoveryOption", i.RecoveryOption) - populate(objectMap, "restoreCriteria", i.RestoreCriteria) - populate(objectMap, "restoreLocation", i.RestoreLocation) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ItemLevelRestoreTargetInfo. -func (i *ItemLevelRestoreTargetInfo) 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", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "datasourceAuthCredentials": - i.DatasourceAuthCredentials, err = unmarshalAuthCredentialsClassification(val) - delete(rawMsg, key) - case "datasourceInfo": - err = unpopulate(val, "DatasourceInfo", &i.DatasourceInfo) - delete(rawMsg, key) - case "datasourceSetInfo": - err = unpopulate(val, "DatasourceSetInfo", &i.DatasourceSetInfo) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &i.ObjectType) - delete(rawMsg, key) - case "recoveryOption": - err = unpopulate(val, "RecoveryOption", &i.RecoveryOption) - delete(rawMsg, key) - case "restoreCriteria": - i.RestoreCriteria, err = unmarshalItemLevelRestoreCriteriaClassificationArray(val) - delete(rawMsg, key) - case "restoreLocation": - err = unpopulate(val, "RestoreLocation", &i.RestoreLocation) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JobExtendedInfo. -func (j JobExtendedInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalDetails", j.AdditionalDetails) - populate(objectMap, "backupInstanceState", j.BackupInstanceState) - populate(objectMap, "dataTransferredInBytes", j.DataTransferredInBytes) - populate(objectMap, "recoveryDestination", j.RecoveryDestination) - populate(objectMap, "sourceRecoverPoint", j.SourceRecoverPoint) - populate(objectMap, "subTasks", j.SubTasks) - populate(objectMap, "targetRecoverPoint", j.TargetRecoverPoint) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type JobSubTask. -func (j JobSubTask) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalDetails", j.AdditionalDetails) - populate(objectMap, "taskId", j.TaskID) - populate(objectMap, "taskName", j.TaskName) - populate(objectMap, "taskProgress", j.TaskProgress) - populate(objectMap, "taskStatus", j.TaskStatus) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type KubernetesPVRestoreCriteria. -func (k KubernetesPVRestoreCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", k.Name) - objectMap["objectType"] = "KubernetesPVRestoreCriteria" - populate(objectMap, "storageClassName", k.StorageClassName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesPVRestoreCriteria. -func (k *KubernetesPVRestoreCriteria) 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", k, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &k.Name) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &k.ObjectType) - delete(rawMsg, key) - case "storageClassName": - err = unpopulate(val, "StorageClassName", &k.StorageClassName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type KubernetesStorageClassRestoreCriteria. -func (k KubernetesStorageClassRestoreCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "KubernetesStorageClassRestoreCriteria" - populate(objectMap, "provisioner", k.Provisioner) - populate(objectMap, "selectedStorageClassName", k.SelectedStorageClassName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type KubernetesStorageClassRestoreCriteria. -func (k *KubernetesStorageClassRestoreCriteria) 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", k, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &k.ObjectType) - delete(rawMsg, key) - case "provisioner": - err = unpopulate(val, "Provisioner", &k.Provisioner) - delete(rawMsg, key) - case "selectedStorageClassName": - err = unpopulate(val, "SelectedStorageClassName", &k.SelectedStorageClassName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", k, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationJobExtendedInfo. -func (o *OperationJobExtendedInfo) 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", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "jobId": - err = unpopulate(val, "JobID", &o.JobID) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &o.ObjectType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResource. -func (o *OperationResource) 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", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &o.EndTime) - delete(rawMsg, key) - case "error": - err = unpopulate(val, "Error", &o.Error) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "properties": - o.Properties, err = unmarshalOperationExtendedInfoClassification(val) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &o.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &o.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PatchResourceRequestInput. -func (p PatchResourceRequestInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", p.Identity) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PolicyParameters. -func (p PolicyParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dataStoreParametersList", p.DataStoreParametersList) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyParameters. -func (p *PolicyParameters) 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 "dataStoreParametersList": - p.DataStoreParametersList, err = unmarshalDataStoreParametersClassificationArray(val) - 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 RangeBasedItemLevelRestoreCriteria. -func (r RangeBasedItemLevelRestoreCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "maxMatchingValue", r.MaxMatchingValue) - populate(objectMap, "minMatchingValue", r.MinMatchingValue) - objectMap["objectType"] = "RangeBasedItemLevelRestoreCriteria" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RangeBasedItemLevelRestoreCriteria. -func (r *RangeBasedItemLevelRestoreCriteria) 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 "maxMatchingValue": - err = unpopulate(val, "MaxMatchingValue", &r.MaxMatchingValue) - delete(rawMsg, key) - case "minMatchingValue": - err = unpopulate(val, "MinMatchingValue", &r.MinMatchingValue) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &r.ObjectType) - 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 RecoveryPointDataStoreDetails. -func (r RecoveryPointDataStoreDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "creationTime", r.CreationTime) - populateTimeRFC3339(objectMap, "expiryTime", r.ExpiryTime) - populate(objectMap, "id", r.ID) - populate(objectMap, "metaData", r.MetaData) - populateTimeRFC3339(objectMap, "rehydrationExpiryTime", r.RehydrationExpiryTime) - populate(objectMap, "rehydrationStatus", r.RehydrationStatus) - populate(objectMap, "state", r.State) - populate(objectMap, "type", r.Type) - populate(objectMap, "visible", r.Visible) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointDataStoreDetails. -func (r *RecoveryPointDataStoreDetails) 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 "creationTime": - err = unpopulateTimeRFC3339(val, "CreationTime", &r.CreationTime) - delete(rawMsg, key) - case "expiryTime": - err = unpopulateTimeRFC3339(val, "ExpiryTime", &r.ExpiryTime) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "metaData": - err = unpopulate(val, "MetaData", &r.MetaData) - delete(rawMsg, key) - case "rehydrationExpiryTime": - err = unpopulateTimeRFC3339(val, "RehydrationExpiryTime", &r.RehydrationExpiryTime) - delete(rawMsg, key) - case "rehydrationStatus": - err = unpopulate(val, "RehydrationStatus", &r.RehydrationStatus) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &r.State) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - case "visible": - err = unpopulate(val, "Visible", &r.Visible) - 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 ResourceGuard. -func (r ResourceGuard) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowAutoApprovals", r.AllowAutoApprovals) - populate(objectMap, "description", r.Description) - populate(objectMap, "provisioningState", r.ProvisioningState) - populate(objectMap, "resourceGuardOperations", r.ResourceGuardOperations) - populate(objectMap, "vaultCriticalOperationExclusionList", r.VaultCriticalOperationExclusionList) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceGuardResource. -func (r ResourceGuardResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - 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) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RestoreFilesTargetInfo. -func (r RestoreFilesTargetInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "RestoreFilesTargetInfo" - populate(objectMap, "recoveryOption", r.RecoveryOption) - populate(objectMap, "restoreLocation", r.RestoreLocation) - populate(objectMap, "targetDetails", r.TargetDetails) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreFilesTargetInfo. -func (r *RestoreFilesTargetInfo) 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 "objectType": - err = unpopulate(val, "ObjectType", &r.ObjectType) - delete(rawMsg, key) - case "recoveryOption": - err = unpopulate(val, "RecoveryOption", &r.RecoveryOption) - delete(rawMsg, key) - case "restoreLocation": - err = unpopulate(val, "RestoreLocation", &r.RestoreLocation) - delete(rawMsg, key) - case "targetDetails": - err = unpopulate(val, "TargetDetails", &r.TargetDetails) - 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 RestoreJobRecoveryPointDetails. -func (r RestoreJobRecoveryPointDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "recoveryPointID", r.RecoveryPointID) - populateTimeRFC3339(objectMap, "recoveryPointTime", r.RecoveryPointTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreJobRecoveryPointDetails. -func (r *RestoreJobRecoveryPointDetails) 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 "recoveryPointID": - err = unpopulate(val, "RecoveryPointID", &r.RecoveryPointID) - delete(rawMsg, key) - case "recoveryPointTime": - err = unpopulateTimeRFC3339(val, "RecoveryPointTime", &r.RecoveryPointTime) - 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 RestoreTargetInfo. -func (r RestoreTargetInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "datasourceAuthCredentials", r.DatasourceAuthCredentials) - populate(objectMap, "datasourceInfo", r.DatasourceInfo) - populate(objectMap, "datasourceSetInfo", r.DatasourceSetInfo) - objectMap["objectType"] = "RestoreTargetInfo" - populate(objectMap, "recoveryOption", r.RecoveryOption) - populate(objectMap, "restoreLocation", r.RestoreLocation) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreTargetInfo. -func (r *RestoreTargetInfo) 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 "datasourceAuthCredentials": - r.DatasourceAuthCredentials, err = unmarshalAuthCredentialsClassification(val) - delete(rawMsg, key) - case "datasourceInfo": - err = unpopulate(val, "DatasourceInfo", &r.DatasourceInfo) - delete(rawMsg, key) - case "datasourceSetInfo": - err = unpopulate(val, "DatasourceSetInfo", &r.DatasourceSetInfo) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &r.ObjectType) - delete(rawMsg, key) - case "recoveryOption": - err = unpopulate(val, "RecoveryOption", &r.RecoveryOption) - delete(rawMsg, key) - case "restoreLocation": - err = unpopulate(val, "RestoreLocation", &r.RestoreLocation) - 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 ScheduleBasedBackupCriteria. -func (s ScheduleBasedBackupCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "absoluteCriteria", s.AbsoluteCriteria) - populate(objectMap, "daysOfMonth", s.DaysOfMonth) - populate(objectMap, "daysOfTheWeek", s.DaysOfTheWeek) - populate(objectMap, "monthsOfYear", s.MonthsOfYear) - objectMap["objectType"] = "ScheduleBasedBackupCriteria" - aux := make([]*timeRFC3339, len(s.ScheduleTimes), len(s.ScheduleTimes)) - for i := 0; i < len(s.ScheduleTimes); i++ { - aux[i] = (*timeRFC3339)(s.ScheduleTimes[i]) - } - populate(objectMap, "scheduleTimes", aux) - populate(objectMap, "weeksOfTheMonth", s.WeeksOfTheMonth) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduleBasedBackupCriteria. -func (s *ScheduleBasedBackupCriteria) 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", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "absoluteCriteria": - err = unpopulate(val, "AbsoluteCriteria", &s.AbsoluteCriteria) - delete(rawMsg, key) - case "daysOfMonth": - err = unpopulate(val, "DaysOfMonth", &s.DaysOfMonth) - delete(rawMsg, key) - case "daysOfTheWeek": - err = unpopulate(val, "DaysOfTheWeek", &s.DaysOfTheWeek) - delete(rawMsg, key) - case "monthsOfYear": - err = unpopulate(val, "MonthsOfYear", &s.MonthsOfYear) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &s.ObjectType) - delete(rawMsg, key) - case "scheduleTimes": - var aux []*timeRFC3339 - err = unpopulate(val, "ScheduleTimes", &aux) - for _, au := range aux { - s.ScheduleTimes = append(s.ScheduleTimes, (*time.Time)(au)) - } - delete(rawMsg, key) - case "weeksOfTheMonth": - err = unpopulate(val, "WeeksOfTheMonth", &s.WeeksOfTheMonth) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduleBasedTriggerContext. -func (s ScheduleBasedTriggerContext) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "ScheduleBasedTriggerContext" - populate(objectMap, "schedule", s.Schedule) - populate(objectMap, "taggingCriteria", s.TaggingCriteria) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduleBasedTriggerContext. -func (s *ScheduleBasedTriggerContext) 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", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &s.ObjectType) - delete(rawMsg, key) - case "schedule": - err = unpopulate(val, "Schedule", &s.Schedule) - delete(rawMsg, key) - case "taggingCriteria": - err = unpopulate(val, "TaggingCriteria", &s.TaggingCriteria) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SecretStoreBasedAuthCredentials. -func (s SecretStoreBasedAuthCredentials) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["objectType"] = "SecretStoreBasedAuthCredentials" - populate(objectMap, "secretStoreResource", s.SecretStoreResource) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SecretStoreBasedAuthCredentials. -func (s *SecretStoreBasedAuthCredentials) 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", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "objectType": - err = unpopulate(val, "ObjectType", &s.ObjectType) - delete(rawMsg, key) - case "secretStoreResource": - err = unpopulate(val, "SecretStoreResource", &s.SecretStoreResource) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SourceLifeCycle. -func (s SourceLifeCycle) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "deleteAfter", s.DeleteAfter) - populate(objectMap, "sourceDataStore", s.SourceDataStore) - populate(objectMap, "targetDataStoreCopySettings", s.TargetDataStoreCopySettings) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SourceLifeCycle. -func (s *SourceLifeCycle) 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", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "deleteAfter": - s.DeleteAfter, err = unmarshalDeleteOptionClassification(val) - delete(rawMsg, key) - case "sourceDataStore": - err = unpopulate(val, "SourceDataStore", &s.SourceDataStore) - delete(rawMsg, key) - case "targetDataStoreCopySettings": - err = unpopulate(val, "TargetDataStoreCopySettings", &s.TargetDataStoreCopySettings) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) 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", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TaggingCriteria. -func (t TaggingCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "criteria", t.Criteria) - populate(objectMap, "isDefault", t.IsDefault) - populate(objectMap, "tagInfo", t.TagInfo) - populate(objectMap, "taggingPriority", t.TaggingPriority) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TaggingCriteria. -func (t *TaggingCriteria) 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", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "criteria": - t.Criteria, err = unmarshalBackupCriteriaClassificationArray(val) - delete(rawMsg, key) - case "isDefault": - err = unpopulate(val, "IsDefault", &t.IsDefault) - delete(rawMsg, key) - case "tagInfo": - err = unpopulate(val, "TagInfo", &t.TagInfo) - delete(rawMsg, key) - case "taggingPriority": - err = unpopulate(val, "TaggingPriority", &t.TaggingPriority) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TargetCopySetting. -func (t TargetCopySetting) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "copyAfter", t.CopyAfter) - populate(objectMap, "dataStore", t.DataStore) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TargetCopySetting. -func (t *TargetCopySetting) 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", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "copyAfter": - t.CopyAfter, err = unmarshalCopyOptionClassification(val) - delete(rawMsg, key) - case "dataStore": - err = unpopulate(val, "DataStore", &t.DataStore) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type UserFacingError. -func (u UserFacingError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "code", u.Code) - populate(objectMap, "details", u.Details) - populate(objectMap, "innerError", u.InnerError) - populate(objectMap, "isRetryable", u.IsRetryable) - populate(objectMap, "isUserError", u.IsUserError) - populate(objectMap, "message", u.Message) - populate(objectMap, "properties", u.Properties) - populate(objectMap, "recommendedAction", u.RecommendedAction) - populate(objectMap, "target", u.Target) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ValidateRestoreRequestObject. -func (v ValidateRestoreRequestObject) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "restoreRequestObject", v.RestoreRequestObject) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateRestoreRequestObject. -func (v *ValidateRestoreRequestObject) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "restoreRequestObject": - v.RestoreRequestObject, err = unmarshalAzureBackupRestoreRequestClassification(val) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}