From 79537d2b6ceff5cef01610506f25570bc41315ad Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 28 Aug 2023 11:37:08 +0000 Subject: [PATCH] CodeGen from PR 25264 in Azure/azure-rest-api-specs Merge 0b3bf4bf70cdab8a267e52e9134811b206a1ab25 into 0c4762d037f0d00d4e384add4e3d7200a2993b2c --- .../armdataprotection/CHANGELOG.md | 40 + .../armdataprotection/autorest.md | 7 +- .../backupinstances_client.go | 448 +++++++--- .../backupinstances_client_example_test.go | 791 ------------------ .../backupinstancesextensionrouting_client.go | 97 +++ .../backuppolicies_client.go | 54 +- .../backuppolicies_client_example_test.go | 448 ---------- .../backupvaultoperationresults_client.go | 24 +- ...ultoperationresults_client_example_test.go | 58 -- .../armdataprotection/backupvaults_client.go | 113 ++- .../backupvaults_client_example_test.go | 611 -------------- .../armdataprotection/client.go | 23 +- .../armdataprotection/client_example_test.go | 61 -- .../armdataprotection/client_factory.go | 87 +- .../armdataprotection/constants.go | 19 +- .../crossregionrestorejob_client.go | 105 +++ .../crossregionrestorejobs_client.go | 111 +++ .../deletedbackupinstances_client.go | 41 +- ...etedbackupinstances_client_example_test.go | 167 ---- .../dppresourceguardproxy_client.go | 74 +- ...presourceguardproxy_client_example_test.go | 192 ----- .../armdataprotection/exportjobs_client.go | 22 +- .../exportjobs_client_example_test.go | 39 - .../exportjobsoperationresult_client.go | 18 +- ...jobsoperationresult_client_example_test.go | 44 - .../dataprotection/armdataprotection/go.mod | 16 +- .../dataprotection/armdataprotection/go.sum | 26 +- .../armdataprotection/interfaces.go | 183 ++++ .../armdataprotection/jobs_client.go | 156 +++- .../jobs_client_example_test.go | 230 ----- .../armdataprotection/models.go | 682 +++------------ .../armdataprotection/models_serde.go | 325 ++++++- .../operationresult_client.go | 24 +- .../operationresult_client_example_test.go | 42 - .../armdataprotection/operations_client.go | 7 +- .../operations_client_example_test.go | 566 ------------- .../operationstatus_client.go | 18 +- .../operationstatus_client_example_test.go | 45 - ...perationstatusbackupvaultcontext_client.go | 18 +- ...sbackupvaultcontext_client_example_test.go | 45 - ...rationstatusresourcegroupcontext_client.go | 18 +- ...esourcegroupcontext_client_example_test.go | 45 - .../armdataprotection/options.go | 451 ++++++++++ .../armdataprotection/polymorphic_helpers.go | 90 +- .../recoverypoints_client.go | 22 +- .../recoverypoints_client_example_test.go | 141 ---- .../resourceguards_client.go | 192 +++-- .../resourceguards_client_example_test.go | 632 -------------- .../armdataprotection/response_types.go | 102 ++- .../restorabletimeranges_client.go | 23 +- ...estorabletimeranges_client_example_test.go | 56 -- .../armdataprotection/secondaryrps_client.go | 120 +++ .../armdataprotection/time_rfc3339.go | 3 +- 53 files changed, 2671 insertions(+), 5301 deletions(-) delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client_example_test.go create mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/backupinstancesextensionrouting_client.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client_example_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client_example_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client_example_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/client_example_test.go create mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/crossregionrestorejob_client.go create mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/crossregionrestorejobs_client.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client_example_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/dppresourceguardproxy_client_example_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client_example_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client_example_test.go create mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/interfaces.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/jobs_client_example_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client_example_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client_example_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client_example_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client_example_test.go create mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/options.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client_example_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client_example_test.go delete mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client_example_test.go create mode 100644 sdk/resourcemanager/dataprotection/armdataprotection/secondaryrps_client.go diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md b/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md index 2ef316a274c9..5fbdf7b82734 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md +++ b/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md @@ -1,5 +1,45 @@ # Release History +## 3.0.0-beta.1 (2023-08-28) +### Breaking Changes + +- Type of `BaseResourceProperties.ObjectType` has been changed from `*string` to `*ResourcePropertiesObjectType` + +### Features Added + +- New enum type `ResourcePropertiesObjectType` with values `ResourcePropertiesObjectTypeDefaultResourceProperties` +- New function `*BackupInstancesClient.BeginTriggerCrossRegionRestore(context.Context, string, string, CrossRegionRestoreRequestObject, *BackupInstancesClientBeginTriggerCrossRegionRestoreOptions) (*runtime.Poller[BackupInstancesClientTriggerCrossRegionRestoreResponse], error)` +- New function `*BackupInstancesClient.BeginValidateCrossRegionRestore(context.Context, string, string, ValidateCrossRegionRestoreRequestObject, *BackupInstancesClientBeginValidateCrossRegionRestoreOptions) (*runtime.Poller[BackupInstancesClientValidateCrossRegionRestoreResponse], error)` +- New function `NewBackupInstancesExtensionRoutingClient(azcore.TokenCredential, *arm.ClientOptions) (*BackupInstancesExtensionRoutingClient, error)` +- New function `*BackupInstancesExtensionRoutingClient.NewListPager(string, *BackupInstancesExtensionRoutingClientListOptions) *runtime.Pager[BackupInstancesExtensionRoutingClientListResponse]` +- New function `*ClientFactory.NewBackupInstancesExtensionRoutingClient() *BackupInstancesExtensionRoutingClient` +- New function `*ClientFactory.NewCrossRegionRestoreJobClient() *CrossRegionRestoreJobClient` +- New function `*ClientFactory.NewCrossRegionRestoreJobsClient() *CrossRegionRestoreJobsClient` +- New function `*ClientFactory.NewSecondaryRPsClient() *SecondaryRPsClient` +- New function `NewCrossRegionRestoreJobClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CrossRegionRestoreJobClient, error)` +- New function `*CrossRegionRestoreJobClient.Get(context.Context, string, string, CrossRegionRestoreJobRequest, *CrossRegionRestoreJobClientGetOptions) (CrossRegionRestoreJobClientGetResponse, error)` +- New function `NewCrossRegionRestoreJobsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CrossRegionRestoreJobsClient, error)` +- New function `*CrossRegionRestoreJobsClient.NewListPager(string, string, CrossRegionRestoreJobsRequest, *CrossRegionRestoreJobsClientListOptions) *runtime.Pager[CrossRegionRestoreJobsClientListResponse]` +- New function `*DefaultResourceProperties.GetBaseResourceProperties() *BaseResourceProperties` +- New function `*JobsClient.GenerateProgressURL(context.Context, string, string, string, *JobsClientGenerateProgressURLOptions) (JobsClientGenerateProgressURLResponse, error)` +- New function `*JobsClient.BeginTriggerCancel(context.Context, string, string, string, *JobsClientBeginTriggerCancelOptions) (*runtime.Poller[JobsClientTriggerCancelResponse], error)` +- New function `NewSecondaryRPsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SecondaryRPsClient, error)` +- New function `*SecondaryRPsClient.NewFetchPager(string, string, FetchSecondaryRPsRequestParameters, *SecondaryRPsClientFetchOptions) *runtime.Pager[SecondaryRPsClientFetchResponse]` +- New struct `AzureBackupJobProgressURL` +- New struct `CrossRegionRestoreDetails` +- New struct `CrossRegionRestoreJobRequest` +- New struct `CrossRegionRestoreJobsRequest` +- New struct `CrossRegionRestoreRequestObject` +- New struct `DefaultResourceProperties` +- New struct `FetchSecondaryRPsRequestParameters` +- New struct `UserAssignedIdentityDetails` +- New struct `UserFacingWarningDetail` +- New struct `ValidateCrossRegionRestoreRequestObject` +- New field `SourceDataStoreType` in struct `AzureBackupJob` +- New field `WarningDetails` in struct `JobExtendedInfo` +- New field `StagingResourceGroupID`, `StagingStorageAccountID` in struct `KubernetesClusterRestoreCriteria` + + ## 2.3.0 (2023-07-28) ### Features Added diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/autorest.md b/sdk/resourcemanager/dataprotection/armdataprotection/autorest.md index 2a5c79ee2a3f..8bf7b58b2c07 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/autorest.md +++ b/sdk/resourcemanager/dataprotection/armdataprotection/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/dataprotection/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/dataprotection/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.3.0 -tag: package-2023-05 +module-version: 3.0.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client.go index 00b774b16713..e8b6b9348bec 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -47,7 +46,7 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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. @@ -60,7 +59,10 @@ func (client *BackupInstancesClient) BeginAdhocBackup(ctx context.Context, resou if err != nil { return nil, err } - return runtime.NewPoller[BackupInstancesClientAdhocBackupResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupInstancesClientAdhocBackupResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupInstancesClientAdhocBackupResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +71,22 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *BackupInstancesClient) adhocBackup(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters TriggerBackupRequest, options *BackupInstancesClientBeginAdhocBackupOptions) (*http.Response, error) { + var err error req, err := client.adhocBackupCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // adhocBackupCreateRequest creates the AdhocBackup request. @@ -106,16 +110,19 @@ func (client *BackupInstancesClient) adhocBackupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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. @@ -128,7 +135,8 @@ func (client *BackupInstancesClient) BeginCreateOrUpdate(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller[BackupInstancesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[BackupInstancesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupInstancesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -137,20 +145,22 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *BackupInstancesClient) createOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters BackupInstanceResource, options *BackupInstancesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -174,16 +184,19 @@ func (client *BackupInstancesClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a backup instance in a backup vault // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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. @@ -195,7 +208,8 @@ func (client *BackupInstancesClient) BeginDelete(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller[BackupInstancesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[BackupInstancesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupInstancesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -204,20 +218,22 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *BackupInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -241,7 +257,7 @@ func (client *BackupInstancesClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -250,24 +266,27 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - backupInstanceName - The name of the backup instance. // - options - BackupInstancesClientGetOptions contains the optional parameters for the BackupInstancesClient.Get method. func (client *BackupInstancesClient) Get(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientGetOptions) (BackupInstancesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { return BackupInstancesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BackupInstancesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BackupInstancesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BackupInstancesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -291,7 +310,7 @@ func (client *BackupInstancesClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -309,25 +328,28 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.getBackupInstanceOperationResultCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, operationID, options) if err != nil { return BackupInstancesClientGetBackupInstanceOperationResultResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BackupInstancesClientGetBackupInstanceOperationResultResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return BackupInstancesClientGetBackupInstanceOperationResultResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return BackupInstancesClientGetBackupInstanceOperationResultResponse{}, err } - return client.getBackupInstanceOperationResultHandleResponse(resp) + resp, err := client.getBackupInstanceOperationResultHandleResponse(httpResp) + return resp, err } // getBackupInstanceOperationResultCreateRequest creates the GetBackupInstanceOperationResult request. @@ -355,7 +377,7 @@ func (client *BackupInstancesClient) getBackupInstanceOperationResultCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -372,7 +394,7 @@ func (client *BackupInstancesClient) getBackupInstanceOperationResultHandleRespo // NewListPager - Gets a backup instances belonging to a backup vault // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - options - BackupInstancesClientListOptions contains the optional parameters for the BackupInstancesClient.NewListPager @@ -422,7 +444,7 @@ func (client *BackupInstancesClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -440,7 +462,7 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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. @@ -452,7 +474,8 @@ func (client *BackupInstancesClient) BeginResumeBackups(ctx context.Context, res if err != nil { return nil, err } - return runtime.NewPoller[BackupInstancesClientResumeBackupsResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[BackupInstancesClientResumeBackupsResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupInstancesClientResumeBackupsResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -461,20 +484,22 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *BackupInstancesClient) resumeBackups(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginResumeBackupsOptions) (*http.Response, error) { + var err error req, err := client.resumeBackupsCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // resumeBackupsCreateRequest creates the ResumeBackups request. @@ -498,7 +523,7 @@ func (client *BackupInstancesClient) resumeBackupsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -507,7 +532,7 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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. @@ -519,7 +544,8 @@ func (client *BackupInstancesClient) BeginResumeProtection(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[BackupInstancesClientResumeProtectionResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[BackupInstancesClientResumeProtectionResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupInstancesClientResumeProtectionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -528,20 +554,22 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *BackupInstancesClient) resumeProtection(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginResumeProtectionOptions) (*http.Response, error) { + var err error req, err := client.resumeProtectionCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // resumeProtectionCreateRequest creates the ResumeProtection request. @@ -565,7 +593,7 @@ func (client *BackupInstancesClient) resumeProtectionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -574,7 +602,7 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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. @@ -586,7 +614,8 @@ func (client *BackupInstancesClient) BeginStopProtection(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller[BackupInstancesClientStopProtectionResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[BackupInstancesClientStopProtectionResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupInstancesClientStopProtectionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -595,20 +624,22 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *BackupInstancesClient) stopProtection(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginStopProtectionOptions) (*http.Response, error) { + var err error req, err := client.stopProtectionCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // stopProtectionCreateRequest creates the StopProtection request. @@ -632,7 +663,7 @@ func (client *BackupInstancesClient) stopProtectionCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -642,7 +673,7 @@ func (client *BackupInstancesClient) stopProtectionCreateRequest(ctx context.Con // (except latest Recovery point, which will be retained forever) // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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. @@ -654,7 +685,8 @@ func (client *BackupInstancesClient) BeginSuspendBackups(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller[BackupInstancesClientSuspendBackupsResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[BackupInstancesClientSuspendBackupsResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupInstancesClientSuspendBackupsResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -664,20 +696,22 @@ func (client *BackupInstancesClient) BeginSuspendBackups(ctx context.Context, re // latest Recovery point, which will be retained forever) // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *BackupInstancesClient) suspendBackups(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *BackupInstancesClientBeginSuspendBackupsOptions) (*http.Response, error) { + var err error req, err := client.suspendBackupsCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // suspendBackupsCreateRequest creates the SuspendBackups request. @@ -701,7 +735,7 @@ func (client *BackupInstancesClient) suspendBackupsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -711,7 +745,7 @@ func (client *BackupInstancesClient) suspendBackupsCreateRequest(ctx context.Con // will bring backup instance to valid state // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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. @@ -724,7 +758,8 @@ func (client *BackupInstancesClient) BeginSyncBackupInstance(ctx context.Context if err != nil { return nil, err } - return runtime.NewPoller[BackupInstancesClientSyncBackupInstanceResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[BackupInstancesClientSyncBackupInstanceResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupInstancesClientSyncBackupInstanceResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -734,20 +769,22 @@ func (client *BackupInstancesClient) BeginSyncBackupInstance(ctx context.Context // bring backup instance to valid state // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *BackupInstancesClient) syncBackupInstance(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters SyncBackupInstanceRequest, options *BackupInstancesClientBeginSyncBackupInstanceOptions) (*http.Response, error) { + var err error req, err := client.syncBackupInstanceCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // syncBackupInstanceCreateRequest creates the SyncBackupInstance request. @@ -771,16 +808,89 @@ func (client *BackupInstancesClient) syncBackupInstanceCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginTriggerCrossRegionRestore - +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parameters - Request body for trigger CRR operation +// - options - BackupInstancesClientBeginTriggerCrossRegionRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginTriggerCrossRegionRestore +// method. +func (client *BackupInstancesClient) BeginTriggerCrossRegionRestore(ctx context.Context, resourceGroupName string, location string, parameters CrossRegionRestoreRequestObject, options *BackupInstancesClientBeginTriggerCrossRegionRestoreOptions) (*runtime.Poller[BackupInstancesClientTriggerCrossRegionRestoreResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.triggerCrossRegionRestore(ctx, resourceGroupName, location, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupInstancesClientTriggerCrossRegionRestoreResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[BackupInstancesClientTriggerCrossRegionRestoreResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// TriggerCrossRegionRestore - +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +func (client *BackupInstancesClient) triggerCrossRegionRestore(ctx context.Context, resourceGroupName string, location string, parameters CrossRegionRestoreRequestObject, options *BackupInstancesClientBeginTriggerCrossRegionRestoreOptions) (*http.Response, error) { + var err error + req, err := client.triggerCrossRegionRestoreCreateRequest(ctx, resourceGroupName, location, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// triggerCrossRegionRestoreCreateRequest creates the TriggerCrossRegionRestore request. +func (client *BackupInstancesClient) triggerCrossRegionRestoreCreateRequest(ctx context.Context, resourceGroupName string, location string, parameters CrossRegionRestoreRequestObject, options *BackupInstancesClientBeginTriggerCrossRegionRestoreOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/crossRegionRestore" + 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 location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginTriggerRehydrate - rehydrate recovery point for restore for a BackupInstance // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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. @@ -793,7 +903,8 @@ func (client *BackupInstancesClient) BeginTriggerRehydrate(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[BackupInstancesClientTriggerRehydrateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[BackupInstancesClientTriggerRehydrateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupInstancesClientTriggerRehydrateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -802,20 +913,22 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *BackupInstancesClient) triggerRehydrate(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupRehydrationRequest, options *BackupInstancesClientBeginTriggerRehydrateOptions) (*http.Response, error) { + var err error req, err := client.triggerRehydrateCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // triggerRehydrateCreateRequest creates the TriggerRehydrate request. @@ -839,16 +952,19 @@ func (client *BackupInstancesClient) triggerRehydrateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginTriggerRestore - Triggers restore for a BackupInstance // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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. @@ -861,7 +977,10 @@ func (client *BackupInstancesClient) BeginTriggerRestore(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller[BackupInstancesClientTriggerRestoreResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupInstancesClientTriggerRestoreResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupInstancesClientTriggerRestoreResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -870,20 +989,22 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *BackupInstancesClient) triggerRestore(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupRestoreRequestClassification, options *BackupInstancesClientBeginTriggerRestoreOptions) (*http.Response, error) { + var err error req, err := client.triggerRestoreCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // triggerRestoreCreateRequest creates the TriggerRestore request. @@ -907,16 +1028,89 @@ func (client *BackupInstancesClient) triggerRestoreCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginValidateCrossRegionRestore - +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parameters - Request body for operation +// - options - BackupInstancesClientBeginValidateCrossRegionRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginValidateCrossRegionRestore +// method. +func (client *BackupInstancesClient) BeginValidateCrossRegionRestore(ctx context.Context, resourceGroupName string, location string, parameters ValidateCrossRegionRestoreRequestObject, options *BackupInstancesClientBeginValidateCrossRegionRestoreOptions) (*runtime.Poller[BackupInstancesClientValidateCrossRegionRestoreResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.validateCrossRegionRestore(ctx, resourceGroupName, location, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupInstancesClientValidateCrossRegionRestoreResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[BackupInstancesClientValidateCrossRegionRestoreResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// ValidateCrossRegionRestore - +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +func (client *BackupInstancesClient) validateCrossRegionRestore(ctx context.Context, resourceGroupName string, location string, parameters ValidateCrossRegionRestoreRequestObject, options *BackupInstancesClientBeginValidateCrossRegionRestoreOptions) (*http.Response, error) { + var err error + req, err := client.validateCrossRegionRestoreCreateRequest(ctx, resourceGroupName, location, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// validateCrossRegionRestoreCreateRequest creates the ValidateCrossRegionRestore request. +func (client *BackupInstancesClient) validateCrossRegionRestoreCreateRequest(ctx context.Context, resourceGroupName string, location string, parameters ValidateCrossRegionRestoreRequestObject, options *BackupInstancesClientBeginValidateCrossRegionRestoreOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/validateCrossRegionRestore" + 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 location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginValidateForBackup - Validate whether adhoc backup will be successful or not // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - parameters - Request body for operation @@ -928,7 +1122,10 @@ func (client *BackupInstancesClient) BeginValidateForBackup(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[BackupInstancesClientValidateForBackupResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupInstancesClientValidateForBackupResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupInstancesClientValidateForBackupResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -937,20 +1134,22 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *BackupInstancesClient) validateForBackup(ctx context.Context, resourceGroupName string, vaultName string, parameters ValidateForBackupRequest, options *BackupInstancesClientBeginValidateForBackupOptions) (*http.Response, error) { + var err error req, err := client.validateForBackupCreateRequest(ctx, resourceGroupName, vaultName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // validateForBackupCreateRequest creates the ValidateForBackup request. @@ -970,16 +1169,19 @@ func (client *BackupInstancesClient) validateForBackupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginValidateForRestore - Validates if Restore can be triggered for a DataSource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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. @@ -992,7 +1194,10 @@ func (client *BackupInstancesClient) BeginValidateForRestore(ctx context.Context if err != nil { return nil, err } - return runtime.NewPoller[BackupInstancesClientValidateForRestoreResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BackupInstancesClientValidateForRestoreResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupInstancesClientValidateForRestoreResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1001,20 +1206,22 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *BackupInstancesClient) validateForRestore(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters ValidateRestoreRequestObject, options *BackupInstancesClientBeginValidateForRestoreOptions) (*http.Response, error) { + var err error req, err := client.validateForRestoreCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // validateForRestoreCreateRequest creates the ValidateForRestore request. @@ -1038,8 +1245,11 @@ func (client *BackupInstancesClient) validateForRestoreCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client_example_test.go deleted file mode 100644 index 90073849c4d8..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backupinstances_client_example_test.go +++ /dev/null @@ -1,791 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupInstancesClient().NewListPager("000pikumar", "PratikPrivatePreviewVault1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.BackupInstanceResourceList = armdataprotection.BackupInstanceResourceList{ - // Value: []*armdataprotection.BackupInstanceResource{ - // { - // Name: to.Ptr("harshitbi2"), - // Type: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances"), - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/backupVaults/PratikPrivatePreviewVault1/backupInstances/harshitbi2"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Properties: &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("OssDB"), - // 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("OssDB"), - // ResourceURI: to.Ptr(""), - // }, - // 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"), - // PolicyVersion: to.Ptr("3.2"), - // }, - // ProtectionStatus: &armdataprotection.ProtectionStatusDetails{ - // Status: to.Ptr(armdataprotection.Status("NotProtected")), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupInstancesClient().Get(ctx, "000pikumar", "PratikPrivatePreviewVault1", "testInstance1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupInstanceResource = armdataprotection.BackupInstanceResource{ - // Name: to.Ptr("harshitbi2"), - // Type: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances"), - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/backupVaults/PratikPrivatePreviewVault1/backupInstances/harshitbi2"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Properties: &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("OssDB"), - // 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("OssDB"), - // ResourceURI: to.Ptr(""), - // }, - // 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"), - // PolicyVersion: to.Ptr("3.2"), - // }, - // ProtectionStatus: &armdataprotection.ProtectionStatusDetails{ - // Status: to.Ptr(armdataprotection.Status("NotProtected")), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupInstancesClient().BeginCreateOrUpdate(ctx, "000pikumar", "PratikPrivatePreviewVault1", "testInstance1", armdataprotection.BackupInstanceResource{ - Tags: map[string]*string{ - "key1": to.Ptr("val1"), - }, - Properties: &armdataprotection.BackupInstance{ - DataSourceInfo: &armdataprotection.Datasource{ - DatasourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - ObjectType: to.Ptr("Datasource"), - ResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb"), - ResourceLocation: to.Ptr(""), - ResourceName: to.Ptr("testdb"), - ResourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - ResourceURI: to.Ptr(""), - }, - DataSourceSetInfo: &armdataprotection.DatasourceSet{ - DatasourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - ObjectType: to.Ptr("DatasourceSet"), - ResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest"), - ResourceLocation: to.Ptr(""), - ResourceName: to.Ptr("viveksipgtest"), - ResourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - ResourceURI: to.Ptr(""), - }, - DatasourceAuthCredentials: &armdataprotection.SecretStoreBasedAuthCredentials{ - ObjectType: to.Ptr("SecretStoreBasedAuthCredentials"), - SecretStoreResource: &armdataprotection.SecretStoreResource{ - SecretStoreType: to.Ptr(armdataprotection.SecretStoreTypeAzureKeyVault), - URI: to.Ptr("https://samplevault.vault.azure.net/secrets/credentials"), - }, - }, - FriendlyName: to.Ptr("harshitbi2"), - ObjectType: to.Ptr("BackupInstance"), - PolicyInfo: &armdataprotection.PolicyInfo{ - PolicyID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/Backupvaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1"), - PolicyParameters: &armdataprotection.PolicyParameters{ - DataStoreParametersList: []armdataprotection.DataStoreParametersClassification{ - &armdataprotection.AzureOperationalStoreParameters{ - DataStoreType: to.Ptr(armdataprotection.DataStoreTypesOperationalStore), - ObjectType: to.Ptr("AzureOperationalStoreParameters"), - ResourceGroupID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest"), - }}, - }, - }, - ValidationType: to.Ptr(armdataprotection.ValidationTypeShallowValidation), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupInstanceResource = armdataprotection.BackupInstanceResource{ - // Name: to.Ptr("harshitbi2"), - // Type: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances"), - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/backupVaults/PratikPrivatePreviewVault1/backupInstances/harshitbi2"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Properties: &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("OssDB"), - // 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("OssDB"), - // ResourceURI: to.Ptr(""), - // }, - // 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"), - // }}, - // }, - // PolicyVersion: to.Ptr("3.2"), - // }, - // ProtectionStatus: &armdataprotection.ProtectionStatusDetails{ - // Status: to.Ptr(armdataprotection.Status("NotProtected")), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupInstancesClient().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/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupInstancesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationJobExtendedInfo = armdataprotection.OperationJobExtendedInfo{ - // ObjectType: to.Ptr("OperationJobExtendedInfo"), - // JobID: to.Ptr("c60cb49-63e8-4b21-b9bd-26277b3fdfae"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupInstancesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationJobExtendedInfo = armdataprotection.OperationJobExtendedInfo{ - // ObjectType: to.Ptr("OperationJobExtendedInfo"), - // JobID: to.Ptr("c60cb49-63e8-4b21-b9bd-26277b3fdfae"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupInstancesClient().GetBackupInstanceOperationResult(ctx, "SampleResourceGroup", "swaggerExample", "testInstance1", "YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA==", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupInstanceResource = armdataprotection.BackupInstanceResource{ - // Name: to.Ptr("testInstance1"), - // Type: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances"), - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/backupVaults/swaggerExample/backupInstances/testInstance1"), - // Properties: &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("OssDB"), - // 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("OssDB"), - // ResourceURI: to.Ptr(""), - // }, - // FriendlyName: to.Ptr("testInstance1"), - // ObjectType: to.Ptr("BackupInstance"), - // PolicyInfo: &armdataprotection.PolicyInfo{ - // PolicyID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/backupVaults/swaggerExample/backupPolicies/PratikPolicy1"), - // PolicyVersion: to.Ptr("3.2"), - // }, - // ProtectionStatus: &armdataprotection.ProtectionStatusDetails{ - // Status: to.Ptr(armdataprotection.StatusConfiguringProtection), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupInstancesClient().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/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/TriggerRestore.json -func ExampleBackupInstancesClient_BeginTriggerRestore_triggerRestore() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupInstancesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationJobExtendedInfo = armdataprotection.OperationJobExtendedInfo{ - // ObjectType: to.Ptr("OperationJobExtendedInfo"), - // JobID: to.Ptr("c60cb49-63e8-4b21-b9bd-26277b3fdfae"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/TriggerRestoreAsFiles.json -func ExampleBackupInstancesClient_BeginTriggerRestore_triggerRestoreAsFiles() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupInstancesClient().BeginTriggerRestore(ctx, "000pikumar", "PrivatePreviewVault1", "testInstance1", &armdataprotection.AzureBackupRecoveryPointBasedRestoreRequest{ - ObjectType: to.Ptr("AzureBackupRecoveryPointBasedRestoreRequest"), - RestoreTargetInfo: &armdataprotection.RestoreFilesTargetInfo{ - ObjectType: to.Ptr("RestoreFilesTargetInfo"), - RecoveryOption: to.Ptr(armdataprotection.RecoveryOptionFailIfExists), - RestoreLocation: to.Ptr("southeastasia"), - TargetDetails: &armdataprotection.TargetDetails{ - FilePrefix: to.Ptr("restoredblob"), - RestoreTargetLocationType: to.Ptr(armdataprotection.RestoreTargetLocationTypeAzureBlobs), - URL: to.Ptr("https://teststorage.blob.core.windows.net/restoretest"), - }, - }, - SourceDataStoreType: to.Ptr(armdataprotection.SourceDataStoreTypeVaultStore), - SourceResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb"), - RecoveryPointID: to.Ptr("hardcodedRP"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationJobExtendedInfo = armdataprotection.OperationJobExtendedInfo{ - // ObjectType: to.Ptr("OperationJobExtendedInfo"), - // JobID: to.Ptr("c60cb49-63e8-4b21-b9bd-26277b3fdfae"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/BackupInstanceOperations/TriggerRestoreWithRehydration.json -func ExampleBackupInstancesClient_BeginTriggerRestore_triggerRestoreWithRehydration() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupInstancesClient().BeginTriggerRestore(ctx, "000pikumar", "PratikPrivatePreviewVault1", "testInstance1", &armdataprotection.AzureBackupRestoreWithRehydrationRequest{ - ObjectType: to.Ptr("AzureBackupRestoreWithRehydrationRequest"), - RestoreTargetInfo: &armdataprotection.RestoreTargetInfo{ - ObjectType: to.Ptr("RestoreTargetInfo"), - RecoveryOption: to.Ptr(armdataprotection.RecoveryOptionFailIfExists), - RestoreLocation: to.Ptr("southeastasia"), - DatasourceInfo: &armdataprotection.Datasource{ - DatasourceType: to.Ptr("OssDB"), - ObjectType: to.Ptr("Datasource"), - ResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb"), - ResourceLocation: to.Ptr(""), - ResourceName: to.Ptr("testdb"), - ResourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - ResourceURI: to.Ptr(""), - }, - DatasourceSetInfo: &armdataprotection.DatasourceSet{ - DatasourceType: to.Ptr("OssDB"), - ObjectType: to.Ptr("DatasourceSet"), - ResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest"), - ResourceLocation: to.Ptr(""), - ResourceName: to.Ptr("viveksipgtest"), - ResourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - ResourceURI: to.Ptr(""), - }, - }, - SourceDataStoreType: to.Ptr(armdataprotection.SourceDataStoreTypeVaultStore), - SourceResourceID: to.Ptr("/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb"), - RecoveryPointID: to.Ptr("hardcodedRP"), - RehydrationPriority: to.Ptr(armdataprotection.RehydrationPriorityHigh), - RehydrationRetentionDuration: to.Ptr("7D"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationJobExtendedInfo = armdataprotection.OperationJobExtendedInfo{ - // ObjectType: to.Ptr("OperationJobExtendedInfo"), - // JobID: to.Ptr("c60cb49-63e8-4b21-b9bd-26277b3fdfae"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupInstancesClient().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/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupInstancesClient().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/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupInstancesClient().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/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupInstancesClient().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/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupInstancesClient().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/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupInstancesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationJobExtendedInfo = armdataprotection.OperationJobExtendedInfo{ - // ObjectType: to.Ptr("OperationJobExtendedInfo"), - // JobID: to.Ptr("c60cb49-63e8-4b21-b9bd-26277b3fdfae"), - // } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backupinstancesextensionrouting_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupinstancesextensionrouting_client.go new file mode 100644 index 000000000000..249a7a6786a4 --- /dev/null +++ b/sdk/resourcemanager/dataprotection/armdataprotection/backupinstancesextensionrouting_client.go @@ -0,0 +1,97 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdataprotection + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// BackupInstancesExtensionRoutingClient contains the methods for the BackupInstancesExtensionRouting group. +// Don't use this type directly, use NewBackupInstancesExtensionRoutingClient() instead. +type BackupInstancesExtensionRoutingClient struct { + internal *arm.Client +} + +// NewBackupInstancesExtensionRoutingClient creates a new instance of BackupInstancesExtensionRoutingClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBackupInstancesExtensionRoutingClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*BackupInstancesExtensionRoutingClient, error) { + cl, err := arm.NewClient(moduleName+".BackupInstancesExtensionRoutingClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BackupInstancesExtensionRoutingClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - Gets a list of backup instances associated with a tracked resource +// +// Generated from API version 2023-06-01-preview +// - resourceID - ARM path of the resource to be protected using Microsoft.DataProtection +// - options - BackupInstancesExtensionRoutingClientListOptions contains the optional parameters for the BackupInstancesExtensionRoutingClient.NewListPager +// method. +func (client *BackupInstancesExtensionRoutingClient) NewListPager(resourceID string, options *BackupInstancesExtensionRoutingClientListOptions) *runtime.Pager[BackupInstancesExtensionRoutingClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[BackupInstancesExtensionRoutingClientListResponse]{ + More: func(page BackupInstancesExtensionRoutingClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BackupInstancesExtensionRoutingClientListResponse) (BackupInstancesExtensionRoutingClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceID, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BackupInstancesExtensionRoutingClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BackupInstancesExtensionRoutingClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BackupInstancesExtensionRoutingClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *BackupInstancesExtensionRoutingClient) listCreateRequest(ctx context.Context, resourceID string, options *BackupInstancesExtensionRoutingClientListOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.DataProtection/backupInstances" + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *BackupInstancesExtensionRoutingClient) listHandleResponse(resp *http.Response) (BackupInstancesExtensionRoutingClientListResponse, error) { + result := BackupInstancesExtensionRoutingClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BackupInstanceResourceList); err != nil { + return BackupInstancesExtensionRoutingClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client.go index 5321bf7d1ee7..25907d5dce6c 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -47,7 +46,7 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - backupPolicyName - Name of the policy @@ -55,18 +54,21 @@ func NewBackupPoliciesClient(subscriptionID string, credential azcore.TokenCrede // - options - BackupPoliciesClientCreateOrUpdateOptions contains the optional parameters for the BackupPoliciesClient.CreateOrUpdate // method. func (client *BackupPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, backupPolicyName string, parameters BaseBackupPolicyResource, options *BackupPoliciesClientCreateOrUpdateOptions) (BackupPoliciesClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vaultName, backupPolicyName, parameters, options) if err != nil { return BackupPoliciesClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BackupPoliciesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BackupPoliciesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BackupPoliciesClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -90,10 +92,13 @@ func (client *BackupPoliciesClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -108,21 +113,23 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, backupPolicyName, options) if err != nil { return BackupPoliciesClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BackupPoliciesClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return BackupPoliciesClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return BackupPoliciesClientDeleteResponse{}, err } return BackupPoliciesClientDeleteResponse{}, nil } @@ -148,7 +155,7 @@ func (client *BackupPoliciesClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -157,23 +164,26 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, backupPolicyName, options) if err != nil { return BackupPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BackupPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BackupPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BackupPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -197,7 +207,7 @@ func (client *BackupPoliciesClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +224,7 @@ func (client *BackupPoliciesClient) getHandleResponse(resp *http.Response) (Back // NewListPager - Returns list of backup policies belonging to a backup vault // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - options - BackupPoliciesClientListOptions contains the optional parameters for the BackupPoliciesClient.NewListPager method. @@ -263,7 +273,7 @@ func (client *BackupPoliciesClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client_example_test.go deleted file mode 100644 index 9e40ed9c9f64..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client_example_test.go +++ /dev/null @@ -1,448 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupPoliciesClient().NewListPager("000pikumar", "PrivatePreviewVault", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.BaseBackupPolicyResourceList = armdataprotection.BaseBackupPolicyResourceList{ - // Value: []*armdataprotection.BaseBackupPolicyResource{ - // { - // Name: to.Ptr("OSSDBPolicy"), - // Type: to.Ptr("Microsoft.DataProtection/backupVaults/backupPolicies"), - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/backupVaults/PrivatePreviewVault/backupPolicies/OSSDBPolicy"), - // 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{ - // ID: to.Ptr("Default_"), - // 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{ - // ID: to.Ptr("Weekly_"), - // 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"), - // }, - // }}, - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupPoliciesClient().Get(ctx, "000pikumar", "PrivatePreviewVault", "OSSDBPolicy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BaseBackupPolicyResource = armdataprotection.BaseBackupPolicyResource{ - // Name: to.Ptr("OSSDBPolicy"), - // Type: to.Ptr("Microsoft.DataProtection/backupVaults/backupPolicies"), - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/backupVaults/PrivatePreviewVault/backupPolicies/OSSDBPolicy"), - // 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{ - // ID: to.Ptr("Default_"), - // 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{ - // ID: to.Ptr("Weekly_"), - // 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"), - // }, - // }}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupPoliciesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BaseBackupPolicyResource = armdataprotection.BaseBackupPolicyResource{ - // Name: to.Ptr("OSSDBPolicy"), - // Type: to.Ptr("Microsoft.DataProtection/backupVaults/backupPolicies"), - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/backupVaults/PrivatePreviewVault/backupPolicies/OSSDBPolicy"), - // 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{ - // ID: to.Ptr("Default_"), - // 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{ - // ID: to.Ptr("Weekly_"), - // 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"), - // }, - // }}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewBackupPoliciesClient().Delete(ctx, "000pikumar", "PrivatePreviewVault", "OSSDBPolicy", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client.go index 5793e6759231..16491bfa8a2e 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -48,24 +47,27 @@ func NewBackupVaultOperationResultsClient(subscriptionID string, credential azco // Get - // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - options - BackupVaultOperationResultsClientGetOptions contains the optional parameters for the BackupVaultOperationResultsClient.Get // method. func (client *BackupVaultOperationResultsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *BackupVaultOperationResultsClientGetOptions) (BackupVaultOperationResultsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, operationID, options) if err != nil { return BackupVaultOperationResultsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BackupVaultOperationResultsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return BackupVaultOperationResultsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return BackupVaultOperationResultsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -89,7 +91,7 @@ func (client *BackupVaultOperationResultsClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -98,12 +100,12 @@ func (client *BackupVaultOperationResultsClient) getCreateRequest(ctx context.Co // getHandleResponse handles the Get response. func (client *BackupVaultOperationResultsClient) getHandleResponse(resp *http.Response) (BackupVaultOperationResultsClientGetResponse, error) { result := BackupVaultOperationResultsClientGetResponse{} - if val := resp.Header.Get("Location"); val != "" { - result.Location = &val - } if val := resp.Header.Get("Azure-AsyncOperation"); val != "" { result.AzureAsyncOperation = &val } + if val := resp.Header.Get("Location"); val != "" { + result.Location = &val + } if val := resp.Header.Get("Retry-After"); val != "" { retryAfter32, err := strconv.ParseInt(val, 10, 32) retryAfter := int32(retryAfter32) diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client_example_test.go deleted file mode 100644 index 6b0ae60efce5..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backupvaultoperationresults_client_example_test.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupVaultOperationResultsClient().Get(ctx, "SampleResourceGroup", "swaggerExample", "YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA==", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupVaultResource = armdataprotection.BackupVaultResource{ - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.DataProtection/Backupvaults"), - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/Backupvaults/swaggerExample"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Identity: &armdataprotection.DppIdentityDetails{ - // Type: to.Ptr("None"), - // }, - // Properties: &armdataprotection.BackupVault{ - // ProvisioningState: to.Ptr(armdataprotection.ProvisioningStateSucceeded), - // StorageSettings: []*armdataprotection.StorageSetting{ - // { - // Type: to.Ptr(armdataprotection.StorageSettingTypesLocallyRedundant), - // DatastoreType: to.Ptr(armdataprotection.StorageSettingStoreTypesVaultStore), - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client.go index 20ea159cef12..80369739343c 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -47,25 +46,28 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - location - The location in which uniqueness will be verified. // - parameters - Check name availability request // - options - BackupVaultsClientCheckNameAvailabilityOptions contains the optional parameters for the BackupVaultsClient.CheckNameAvailability // method. func (client *BackupVaultsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, location string, parameters CheckNameAvailabilityRequest, options *BackupVaultsClientCheckNameAvailabilityOptions) (BackupVaultsClientCheckNameAvailabilityResponse, error) { + var err error req, err := client.checkNameAvailabilityCreateRequest(ctx, resourceGroupName, location, parameters, options) if err != nil { return BackupVaultsClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BackupVaultsClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BackupVaultsClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BackupVaultsClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -85,10 +87,13 @@ func (client *BackupVaultsClient) checkNameAvailabilityCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -103,7 +108,7 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - parameters - Request body for operation @@ -115,7 +120,8 @@ func (client *BackupVaultsClient) BeginCreateOrUpdate(ctx context.Context, resou if err != nil { return nil, err } - return runtime.NewPoller[BackupVaultsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[BackupVaultsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupVaultsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -124,20 +130,22 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *BackupVaultsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, parameters BackupVaultResource, options *BackupVaultsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vaultName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -157,16 +165,19 @@ func (client *BackupVaultsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a BackupVault resource from the resource group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - options - BackupVaultsClientBeginDeleteOptions contains the optional parameters for the BackupVaultsClient.BeginDelete @@ -177,7 +188,8 @@ func (client *BackupVaultsClient) BeginDelete(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller[BackupVaultsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[BackupVaultsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupVaultsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -186,20 +198,22 @@ func (client *BackupVaultsClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Deletes a BackupVault resource from the resource group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *BackupVaultsClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, options *BackupVaultsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -219,7 +233,7 @@ func (client *BackupVaultsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -228,23 +242,26 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { return BackupVaultsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return BackupVaultsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BackupVaultsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BackupVaultsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -264,7 +281,7 @@ func (client *BackupVaultsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,7 +298,7 @@ func (client *BackupVaultsClient) getHandleResponse(resp *http.Response) (Backup // NewGetInResourceGroupPager - Returns resource collection belonging to a resource group. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - BackupVaultsClientGetInResourceGroupOptions contains the optional parameters for the BackupVaultsClient.NewGetInResourceGroupPager // method. @@ -326,7 +343,7 @@ func (client *BackupVaultsClient) getInResourceGroupCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -343,7 +360,7 @@ func (client *BackupVaultsClient) getInResourceGroupHandleResponse(resp *http.Re // NewGetInSubscriptionPager - Returns resource collection belonging to a subscription. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - options - BackupVaultsClientGetInSubscriptionOptions contains the optional parameters for the BackupVaultsClient.NewGetInSubscriptionPager // method. func (client *BackupVaultsClient) NewGetInSubscriptionPager(options *BackupVaultsClientGetInSubscriptionOptions) *runtime.Pager[BackupVaultsClientGetInSubscriptionResponse] { @@ -383,7 +400,7 @@ func (client *BackupVaultsClient) getInSubscriptionCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -401,7 +418,7 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - parameters - Request body for operation @@ -413,7 +430,8 @@ func (client *BackupVaultsClient) BeginUpdate(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller[BackupVaultsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[BackupVaultsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[BackupVaultsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -422,20 +440,22 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *BackupVaultsClient) update(ctx context.Context, resourceGroupName string, vaultName string, parameters PatchResourceRequestInput, options *BackupVaultsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, vaultName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -455,8 +475,11 @@ func (client *BackupVaultsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client_example_test.go deleted file mode 100644 index 258872b9c5ec..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/backupvaults_client_example_test.go +++ /dev/null @@ -1,611 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupVaultsClient().NewGetInSubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.BackupVaultResourceList = armdataprotection.BackupVaultResourceList{ - // Value: []*armdataprotection.BackupVaultResource{ - // { - // Name: to.Ptr("ExampleVault1"), - // Type: to.Ptr("Microsoft.DataProtection/BackupVaults"), - // ID: to.Ptr("/subscriptions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup2/providers/Microsoft.DataProtection/BackupVaults/ExampleVault1"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Identity: &armdataprotection.DppIdentityDetails{ - // Type: to.Ptr("None"), - // }, - // Properties: &armdataprotection.BackupVault{ - // FeatureSettings: &armdataprotection.FeatureSettings{ - // CrossRegionRestoreSettings: &armdataprotection.CrossRegionRestoreSettings{ - // State: to.Ptr(armdataprotection.CrossRegionRestoreStateEnabled), - // }, - // }, - // ProvisioningState: to.Ptr(armdataprotection.ProvisioningStateSucceeded), - // SecureScore: to.Ptr(armdataprotection.SecureScoreLevelAdequate), - // SecuritySettings: &armdataprotection.SecuritySettings{ - // SoftDeleteSettings: &armdataprotection.SoftDeleteSettings{ - // RetentionDurationInDays: to.Ptr[float64](14), - // State: to.Ptr(armdataprotection.SoftDeleteState("Enabled")), - // }, - // }, - // StorageSettings: []*armdataprotection.StorageSetting{ - // { - // Type: to.Ptr(armdataprotection.StorageSettingTypesLocallyRedundant), - // DatastoreType: to.Ptr(armdataprotection.StorageSettingStoreTypesVaultStore), - // }}, - // }, - // }, - // { - // Name: to.Ptr("ExampleVault2"), - // Type: to.Ptr("Microsoft.DataProtection/BackupVaults"), - // ID: to.Ptr("/subscriptions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/BackupVaults/ExampleVault2"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Identity: &armdataprotection.DppIdentityDetails{ - // Type: to.Ptr("None"), - // }, - // Properties: &armdataprotection.BackupVault{ - // FeatureSettings: &armdataprotection.FeatureSettings{ - // CrossRegionRestoreSettings: &armdataprotection.CrossRegionRestoreSettings{ - // State: to.Ptr(armdataprotection.CrossRegionRestoreStateEnabled), - // }, - // }, - // ProvisioningState: to.Ptr(armdataprotection.ProvisioningStateSucceeded), - // SecureScore: to.Ptr(armdataprotection.SecureScoreLevelAdequate), - // SecuritySettings: &armdataprotection.SecuritySettings{ - // SoftDeleteSettings: &armdataprotection.SoftDeleteSettings{ - // RetentionDurationInDays: to.Ptr[float64](14), - // State: to.Ptr(armdataprotection.SoftDeleteState("Enabled")), - // }, - // }, - // StorageSettings: []*armdataprotection.StorageSetting{ - // { - // Type: to.Ptr(armdataprotection.StorageSettingTypesLocallyRedundant), - // DatastoreType: to.Ptr(armdataprotection.StorageSettingStoreTypesVaultStore), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBackupVaultsClient().NewGetInResourceGroupPager("SampleResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.BackupVaultResourceList = armdataprotection.BackupVaultResourceList{ - // Value: []*armdataprotection.BackupVaultResource{ - // { - // Name: to.Ptr("ExampleVault1"), - // Type: to.Ptr("Microsoft.DataProtection/BackupVaults"), - // ID: to.Ptr("/subscriptions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/BackupVaults/ExampleVault1"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Identity: &armdataprotection.DppIdentityDetails{ - // Type: to.Ptr("None"), - // }, - // Properties: &armdataprotection.BackupVault{ - // FeatureSettings: &armdataprotection.FeatureSettings{ - // CrossRegionRestoreSettings: &armdataprotection.CrossRegionRestoreSettings{ - // State: to.Ptr(armdataprotection.CrossRegionRestoreStateEnabled), - // }, - // }, - // ProvisioningState: to.Ptr(armdataprotection.ProvisioningStateSucceeded), - // SecureScore: to.Ptr(armdataprotection.SecureScoreLevelAdequate), - // SecuritySettings: &armdataprotection.SecuritySettings{ - // SoftDeleteSettings: &armdataprotection.SoftDeleteSettings{ - // RetentionDurationInDays: to.Ptr[float64](14), - // State: to.Ptr(armdataprotection.SoftDeleteState("Enabled")), - // }, - // }, - // StorageSettings: []*armdataprotection.StorageSetting{ - // { - // Type: to.Ptr(armdataprotection.StorageSettingTypesLocallyRedundant), - // DatastoreType: to.Ptr(armdataprotection.StorageSettingStoreTypesVaultStore), - // }}, - // }, - // }, - // { - // Name: to.Ptr("ExampleVault2"), - // Type: to.Ptr("Microsoft.DataProtection/BackupVaults"), - // ID: to.Ptr("/subscriptions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/BackupVaults/ExampleVault2"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Identity: &armdataprotection.DppIdentityDetails{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("c009b9a0-0024-417c-83cd-025d3776045d"), - // TenantID: to.Ptr("83abe5cd-bcc3-441a-bd86-e6a75360cecc"), - // }, - // Properties: &armdataprotection.BackupVault{ - // FeatureSettings: &armdataprotection.FeatureSettings{ - // CrossRegionRestoreSettings: &armdataprotection.CrossRegionRestoreSettings{ - // State: to.Ptr(armdataprotection.CrossRegionRestoreStateEnabled), - // }, - // }, - // MonitoringSettings: &armdataprotection.MonitoringSettings{ - // AzureMonitorAlertSettings: &armdataprotection.AzureMonitorAlertSettings{ - // AlertsForAllJobFailures: to.Ptr(armdataprotection.AlertsStateEnabled), - // }, - // }, - // ProvisioningState: to.Ptr(armdataprotection.ProvisioningStateSucceeded), - // SecureScore: to.Ptr(armdataprotection.SecureScoreLevelAdequate), - // SecuritySettings: &armdataprotection.SecuritySettings{ - // SoftDeleteSettings: &armdataprotection.SoftDeleteSettings{ - // RetentionDurationInDays: to.Ptr[float64](14), - // State: to.Ptr(armdataprotection.SoftDeleteState("Enabled")), - // }, - // }, - // StorageSettings: []*armdataprotection.StorageSetting{ - // { - // Type: to.Ptr(armdataprotection.StorageSettingTypesLocallyRedundant), - // DatastoreType: to.Ptr(armdataprotection.StorageSettingStoreTypesVaultStore), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/GetBackupVault.json -func ExampleBackupVaultsClient_Get_getBackupVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupVaultsClient().Get(ctx, "SampleResourceGroup", "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupVaultResource = armdataprotection.BackupVaultResource{ - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.DataProtection/Backupvaults"), - // ID: to.Ptr("/subscriptions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/Backupvaults/swaggerExample"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Identity: &armdataprotection.DppIdentityDetails{ - // Type: to.Ptr("None"), - // }, - // Properties: &armdataprotection.BackupVault{ - // FeatureSettings: &armdataprotection.FeatureSettings{ - // CrossRegionRestoreSettings: &armdataprotection.CrossRegionRestoreSettings{ - // State: to.Ptr(armdataprotection.CrossRegionRestoreStateEnabled), - // }, - // }, - // MonitoringSettings: &armdataprotection.MonitoringSettings{ - // AzureMonitorAlertSettings: &armdataprotection.AzureMonitorAlertSettings{ - // AlertsForAllJobFailures: to.Ptr(armdataprotection.AlertsStateEnabled), - // }, - // }, - // ProvisioningState: to.Ptr(armdataprotection.ProvisioningStateSucceeded), - // SecureScore: to.Ptr(armdataprotection.SecureScoreLevelAdequate), - // SecuritySettings: &armdataprotection.SecuritySettings{ - // SoftDeleteSettings: &armdataprotection.SoftDeleteSettings{ - // RetentionDurationInDays: to.Ptr[float64](14), - // State: to.Ptr(armdataprotection.SoftDeleteState("Enabled")), - // }, - // }, - // StorageSettings: []*armdataprotection.StorageSetting{ - // { - // Type: to.Ptr(armdataprotection.StorageSettingTypesLocallyRedundant), - // DatastoreType: to.Ptr(armdataprotection.StorageSettingStoreTypesVaultStore), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/GetBackupVaultWithMSI.json -func ExampleBackupVaultsClient_Get_getBackupVaultWithMsi() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupVaultsClient().Get(ctx, "SampleResourceGroup", "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupVaultResource = armdataprotection.BackupVaultResource{ - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.DataProtection/Backupvaults"), - // ID: to.Ptr("/subscriptions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/Backupvaults/swaggerExample"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Identity: &armdataprotection.DppIdentityDetails{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("c009b9a0-0024-417c-83cd-025d3776045d"), - // TenantID: to.Ptr("83abe5cd-bcc3-441a-bd86-e6a75360cecc"), - // }, - // Properties: &armdataprotection.BackupVault{ - // FeatureSettings: &armdataprotection.FeatureSettings{ - // CrossRegionRestoreSettings: &armdataprotection.CrossRegionRestoreSettings{ - // State: to.Ptr(armdataprotection.CrossRegionRestoreStateEnabled), - // }, - // }, - // ProvisioningState: to.Ptr(armdataprotection.ProvisioningStateSucceeded), - // SecureScore: to.Ptr(armdataprotection.SecureScoreLevelAdequate), - // SecuritySettings: &armdataprotection.SecuritySettings{ - // SoftDeleteSettings: &armdataprotection.SoftDeleteSettings{ - // RetentionDurationInDays: to.Ptr[float64](14), - // State: to.Ptr(armdataprotection.SoftDeleteState("Enabled")), - // }, - // }, - // StorageSettings: []*armdataprotection.StorageSetting{ - // { - // Type: to.Ptr(armdataprotection.StorageSettingTypesLocallyRedundant), - // DatastoreType: to.Ptr(armdataprotection.StorageSettingStoreTypesVaultStore), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/PutBackupVault.json -func ExampleBackupVaultsClient_BeginCreateOrUpdate_createBackupVault() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupVaultsClient().BeginCreateOrUpdate(ctx, "SampleResourceGroup", "swaggerExample", armdataprotection.BackupVaultResource{ - Location: to.Ptr("WestUS"), - Tags: map[string]*string{ - "key1": to.Ptr("val1"), - }, - Identity: &armdataprotection.DppIdentityDetails{ - Type: to.Ptr("None"), - }, - Properties: &armdataprotection.BackupVault{ - FeatureSettings: &armdataprotection.FeatureSettings{ - CrossRegionRestoreSettings: &armdataprotection.CrossRegionRestoreSettings{ - State: to.Ptr(armdataprotection.CrossRegionRestoreStateEnabled), - }, - }, - MonitoringSettings: &armdataprotection.MonitoringSettings{ - AzureMonitorAlertSettings: &armdataprotection.AzureMonitorAlertSettings{ - AlertsForAllJobFailures: to.Ptr(armdataprotection.AlertsStateEnabled), - }, - }, - SecuritySettings: &armdataprotection.SecuritySettings{ - SoftDeleteSettings: &armdataprotection.SoftDeleteSettings{ - RetentionDurationInDays: to.Ptr[float64](14), - State: to.Ptr(armdataprotection.SoftDeleteState("Enabled")), - }, - }, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupVaultResource = armdataprotection.BackupVaultResource{ - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.DataProtection/Backupvaults"), - // ID: to.Ptr("/subscriptions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/Backupvaults/swaggerExample"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Identity: &armdataprotection.DppIdentityDetails{ - // Type: to.Ptr("None"), - // }, - // Properties: &armdataprotection.BackupVault{ - // FeatureSettings: &armdataprotection.FeatureSettings{ - // CrossRegionRestoreSettings: &armdataprotection.CrossRegionRestoreSettings{ - // State: to.Ptr(armdataprotection.CrossRegionRestoreStateEnabled), - // }, - // }, - // MonitoringSettings: &armdataprotection.MonitoringSettings{ - // AzureMonitorAlertSettings: &armdataprotection.AzureMonitorAlertSettings{ - // AlertsForAllJobFailures: to.Ptr(armdataprotection.AlertsStateEnabled), - // }, - // }, - // ProvisioningState: to.Ptr(armdataprotection.ProvisioningStateSucceeded), - // SecureScore: to.Ptr(armdataprotection.SecureScoreLevelAdequate), - // SecuritySettings: &armdataprotection.SecuritySettings{ - // SoftDeleteSettings: &armdataprotection.SoftDeleteSettings{ - // RetentionDurationInDays: to.Ptr[float64](14), - // State: to.Ptr(armdataprotection.SoftDeleteState("Enabled")), - // }, - // }, - // StorageSettings: []*armdataprotection.StorageSetting{ - // { - // Type: to.Ptr(armdataprotection.StorageSettingTypesLocallyRedundant), - // DatastoreType: to.Ptr(armdataprotection.StorageSettingStoreTypesVaultStore), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/PutBackupVaultWithMSI.json -func ExampleBackupVaultsClient_BeginCreateOrUpdate_createBackupVaultWithMsi() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupVaultsClient().BeginCreateOrUpdate(ctx, "SampleResourceGroup", "swaggerExample", armdataprotection.BackupVaultResource{ - Location: to.Ptr("WestUS"), - Tags: map[string]*string{ - "key1": to.Ptr("val1"), - }, - Identity: &armdataprotection.DppIdentityDetails{ - Type: to.Ptr("systemAssigned"), - }, - Properties: &armdataprotection.BackupVault{ - FeatureSettings: &armdataprotection.FeatureSettings{ - CrossRegionRestoreSettings: &armdataprotection.CrossRegionRestoreSettings{ - State: to.Ptr(armdataprotection.CrossRegionRestoreStateEnabled), - }, - }, - MonitoringSettings: &armdataprotection.MonitoringSettings{ - AzureMonitorAlertSettings: &armdataprotection.AzureMonitorAlertSettings{ - AlertsForAllJobFailures: to.Ptr(armdataprotection.AlertsStateEnabled), - }, - }, - SecuritySettings: &armdataprotection.SecuritySettings{ - SoftDeleteSettings: &armdataprotection.SoftDeleteSettings{ - RetentionDurationInDays: to.Ptr[float64](14), - State: to.Ptr(armdataprotection.SoftDeleteState("Enabled")), - }, - }, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupVaultResource = armdataprotection.BackupVaultResource{ - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.DataProtection/Backupvaults"), - // ID: to.Ptr("/subscriptions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/Backupvaults/swaggerExample"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Identity: &armdataprotection.DppIdentityDetails{ - // Type: to.Ptr("SystemAssigned"), - // PrincipalID: to.Ptr("c009b9a0-0024-417c-83cd-025d3776045d"), - // TenantID: to.Ptr("83abe5cd-bcc3-441a-bd86-e6a75360cecc"), - // }, - // Properties: &armdataprotection.BackupVault{ - // FeatureSettings: &armdataprotection.FeatureSettings{ - // CrossRegionRestoreSettings: &armdataprotection.CrossRegionRestoreSettings{ - // State: to.Ptr(armdataprotection.CrossRegionRestoreStateEnabled), - // }, - // }, - // MonitoringSettings: &armdataprotection.MonitoringSettings{ - // AzureMonitorAlertSettings: &armdataprotection.AzureMonitorAlertSettings{ - // AlertsForAllJobFailures: to.Ptr(armdataprotection.AlertsStateEnabled), - // }, - // }, - // ProvisioningState: to.Ptr(armdataprotection.ProvisioningStateSucceeded), - // SecureScore: to.Ptr(armdataprotection.SecureScoreLevelAdequate), - // SecuritySettings: &armdataprotection.SecuritySettings{ - // SoftDeleteSettings: &armdataprotection.SoftDeleteSettings{ - // RetentionDurationInDays: to.Ptr[float64](14), - // State: to.Ptr(armdataprotection.SoftDeleteState("Enabled")), - // }, - // }, - // StorageSettings: []*armdataprotection.StorageSetting{ - // { - // Type: to.Ptr(armdataprotection.StorageSettingTypesLocallyRedundant), - // DatastoreType: to.Ptr(armdataprotection.StorageSettingStoreTypesVaultStore), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/VaultCRUD/DeleteBackupVault.json -func ExampleBackupVaultsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupVaultsClient().BeginDelete(ctx, "SampleResourceGroup", "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBackupVaultsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.BackupVaultResource = armdataprotection.BackupVaultResource{ - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.DataProtection/Backupvaults"), - // ID: to.Ptr("/subscriptions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/Backupvaults/swaggerExample"), - // Location: to.Ptr("WestUS"), - // Tags: map[string]*string{ - // "newKey": to.Ptr("newVal"), - // }, - // Properties: &armdataprotection.BackupVault{ - // MonitoringSettings: &armdataprotection.MonitoringSettings{ - // AzureMonitorAlertSettings: &armdataprotection.AzureMonitorAlertSettings{ - // AlertsForAllJobFailures: to.Ptr(armdataprotection.AlertsStateEnabled), - // }, - // }, - // ProvisioningState: to.Ptr(armdataprotection.ProvisioningStateSucceeded), - // StorageSettings: []*armdataprotection.StorageSetting{ - // { - // Type: to.Ptr(armdataprotection.StorageSettingTypesLocallyRedundant), - // DatastoreType: to.Ptr(armdataprotection.StorageSettingStoreTypesVaultStore), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBackupVaultsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameAvailabilityResult = armdataprotection.CheckNameAvailabilityResult{ - // NameAvailable: to.Ptr(true), - // } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/client.go b/sdk/resourcemanager/dataprotection/armdataprotection/client.go index dc81e1dbe77f..39df88fd3f8a 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -47,22 +46,25 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.checkFeatureSupportCreateRequest(ctx, location, parameters, options) if err != nil { return ClientCheckFeatureSupportResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientCheckFeatureSupportResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientCheckFeatureSupportResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientCheckFeatureSupportResponse{}, err } - return client.checkFeatureSupportHandleResponse(resp) + resp, err := client.checkFeatureSupportHandleResponse(httpResp) + return resp, err } // checkFeatureSupportCreateRequest creates the CheckFeatureSupport request. @@ -78,10 +80,13 @@ func (client *Client) checkFeatureSupportCreateRequest(ctx context.Context, loca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // checkFeatureSupportHandleResponse handles the CheckFeatureSupport response. diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/client_example_test.go deleted file mode 100644 index 86b0a330a23d..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/client_example_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armdataprotection.ClientCheckFeatureSupportResponse{ - // FeatureValidationResponseBaseClassification: &armdataprotection.FeatureValidationResponse{ - // ObjectType: to.Ptr("FeatureValidationResponse"), - // FeatureType: to.Ptr(armdataprotection.FeatureTypeDataSourceType), - // Features: []*armdataprotection.SupportedFeature{ - // { - // ExposureControlledFeatures: []*string{ - // }, - // FeatureName: to.Ptr("Microsoft.Storage/storageAccounts/blobServices"), - // SupportStatus: to.Ptr(armdataprotection.FeatureSupportStatusPrivatePreview), - // }, - // { - // ExposureControlledFeatures: []*string{ - // }, - // FeatureName: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - // SupportStatus: to.Ptr(armdataprotection.FeatureSupportStatusPublicPreview), - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/client_factory.go b/sdk/resourcemanager/dataprotection/armdataprotection/client_factory.go index f72158f5a7f1..5568d7dd3c0c 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/client_factory.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/client_factory.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -38,58 +37,63 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewBackupVaultsClient() *BackupVaultsClient { - subClient, _ := NewBackupVaultsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewBackupInstancesClient() *BackupInstancesClient { + subClient, _ := NewBackupInstancesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationResultClient() *OperationResultClient { - subClient, _ := NewOperationResultClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewBackupInstancesExtensionRoutingClient() *BackupInstancesExtensionRoutingClient { + subClient, _ := NewBackupInstancesExtensionRoutingClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationStatusClient() *OperationStatusClient { - subClient, _ := NewOperationStatusClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewBackupPoliciesClient() *BackupPoliciesClient { + subClient, _ := NewBackupPoliciesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationStatusBackupVaultContextClient() *OperationStatusBackupVaultContextClient { - subClient, _ := NewOperationStatusBackupVaultContextClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewBackupVaultOperationResultsClient() *BackupVaultOperationResultsClient { + subClient, _ := NewBackupVaultOperationResultsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationStatusResourceGroupContextClient() *OperationStatusResourceGroupContextClient { - subClient, _ := NewOperationStatusResourceGroupContextClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewBackupVaultsClient() *BackupVaultsClient { + subClient, _ := NewBackupVaultsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewBackupVaultOperationResultsClient() *BackupVaultOperationResultsClient { - subClient, _ := NewBackupVaultOperationResultsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewClient() *Client { + subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewClient() *Client { - subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewCrossRegionRestoreJobClient() *CrossRegionRestoreJobClient { + subClient, _ := NewCrossRegionRestoreJobClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewCrossRegionRestoreJobsClient() *CrossRegionRestoreJobsClient { + subClient, _ := NewCrossRegionRestoreJobsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewBackupPoliciesClient() *BackupPoliciesClient { - subClient, _ := NewBackupPoliciesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDeletedBackupInstancesClient() *DeletedBackupInstancesClient { + subClient, _ := NewDeletedBackupInstancesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewBackupInstancesClient() *BackupInstancesClient { - subClient, _ := NewBackupInstancesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDppResourceGuardProxyClient() *DppResourceGuardProxyClient { + subClient, _ := NewDppResourceGuardProxyClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRecoveryPointsClient() *RecoveryPointsClient { - subClient, _ := NewRecoveryPointsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewExportJobsClient() *ExportJobsClient { + subClient, _ := NewExportJobsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewExportJobsOperationResultClient() *ExportJobsOperationResultClient { + subClient, _ := NewExportJobsOperationResultClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -98,23 +102,33 @@ func (c *ClientFactory) NewJobsClient() *JobsClient { return subClient } -func (c *ClientFactory) NewRestorableTimeRangesClient() *RestorableTimeRangesClient { - subClient, _ := NewRestorableTimeRangesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationResultClient() *OperationResultClient { + subClient, _ := NewOperationResultClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewExportJobsClient() *ExportJobsClient { - subClient, _ := NewExportJobsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationStatusBackupVaultContextClient() *OperationStatusBackupVaultContextClient { + subClient, _ := NewOperationStatusBackupVaultContextClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewExportJobsOperationResultClient() *ExportJobsOperationResultClient { - subClient, _ := NewExportJobsOperationResultClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationStatusClient() *OperationStatusClient { + subClient, _ := NewOperationStatusClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDeletedBackupInstancesClient() *DeletedBackupInstancesClient { - subClient, _ := NewDeletedBackupInstancesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationStatusResourceGroupContextClient() *OperationStatusResourceGroupContextClient { + subClient, _ := NewOperationStatusResourceGroupContextClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewRecoveryPointsClient() *RecoveryPointsClient { + subClient, _ := NewRecoveryPointsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -123,7 +137,12 @@ func (c *ClientFactory) NewResourceGuardsClient() *ResourceGuardsClient { return subClient } -func (c *ClientFactory) NewDppResourceGuardProxyClient() *DppResourceGuardProxyClient { - subClient, _ := NewDppResourceGuardProxyClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRestorableTimeRangesClient() *RestorableTimeRangesClient { + subClient, _ := NewRestorableTimeRangesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSecondaryRPsClient() *SecondaryRPsClient { + subClient, _ := NewSecondaryRPsClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/constants.go b/sdk/resourcemanager/dataprotection/armdataprotection/constants.go index 7aa33104d47a..56fd9e7b5050 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/constants.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/constants.go @@ -3,15 +3,14 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection const ( moduleName = "armdataprotection" - moduleVersion = "v2.3.0" + moduleVersion = "v3.0.0-beta.1" ) type AbsoluteMarker string @@ -417,6 +416,20 @@ func PossibleResourceMoveStateValues() []ResourceMoveState { } } +// ResourcePropertiesObjectType - Type of the specific object - used for deserializing +type ResourcePropertiesObjectType string + +const ( + ResourcePropertiesObjectTypeDefaultResourceProperties ResourcePropertiesObjectType = "DefaultResourceProperties" +) + +// PossibleResourcePropertiesObjectTypeValues returns the possible values for the ResourcePropertiesObjectType const type. +func PossibleResourcePropertiesObjectTypeValues() []ResourcePropertiesObjectType { + return []ResourcePropertiesObjectType{ + ResourcePropertiesObjectTypeDefaultResourceProperties, + } +} + // RestoreSourceDataStoreType - Gets or sets the type of the source data store. type RestoreSourceDataStoreType string diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/crossregionrestorejob_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/crossregionrestorejob_client.go new file mode 100644 index 000000000000..f678b2418ce5 --- /dev/null +++ b/sdk/resourcemanager/dataprotection/armdataprotection/crossregionrestorejob_client.go @@ -0,0 +1,105 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdataprotection + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CrossRegionRestoreJobClient contains the methods for the CrossRegionRestoreJob group. +// Don't use this type directly, use NewCrossRegionRestoreJobClient() instead. +type CrossRegionRestoreJobClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCrossRegionRestoreJobClient creates a new instance of CrossRegionRestoreJobClient 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 NewCrossRegionRestoreJobClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CrossRegionRestoreJobClient, error) { + cl, err := arm.NewClient(moduleName+".CrossRegionRestoreJobClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CrossRegionRestoreJobClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parameters - Request body for operation +// - options - CrossRegionRestoreJobClientGetOptions contains the optional parameters for the CrossRegionRestoreJobClient.Get +// method. +func (client *CrossRegionRestoreJobClient) Get(ctx context.Context, resourceGroupName string, location string, parameters CrossRegionRestoreJobRequest, options *CrossRegionRestoreJobClientGetOptions) (CrossRegionRestoreJobClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, location, parameters, options) + if err != nil { + return CrossRegionRestoreJobClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CrossRegionRestoreJobClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CrossRegionRestoreJobClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CrossRegionRestoreJobClient) getCreateRequest(ctx context.Context, resourceGroupName string, location string, parameters CrossRegionRestoreJobRequest, options *CrossRegionRestoreJobClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchCrossRegionRestoreJob" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CrossRegionRestoreJobClient) getHandleResponse(resp *http.Response) (CrossRegionRestoreJobClientGetResponse, error) { + result := CrossRegionRestoreJobClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBackupJobResource); err != nil { + return CrossRegionRestoreJobClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/crossregionrestorejobs_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/crossregionrestorejobs_client.go new file mode 100644 index 000000000000..14f59473387d --- /dev/null +++ b/sdk/resourcemanager/dataprotection/armdataprotection/crossregionrestorejobs_client.go @@ -0,0 +1,111 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdataprotection + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CrossRegionRestoreJobsClient contains the methods for the CrossRegionRestoreJobs group. +// Don't use this type directly, use NewCrossRegionRestoreJobsClient() instead. +type CrossRegionRestoreJobsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCrossRegionRestoreJobsClient creates a new instance of CrossRegionRestoreJobsClient 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 NewCrossRegionRestoreJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CrossRegionRestoreJobsClient, error) { + cl, err := arm.NewClient(moduleName+".CrossRegionRestoreJobsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CrossRegionRestoreJobsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parameters - Request body for operation +// - options - CrossRegionRestoreJobsClientListOptions contains the optional parameters for the CrossRegionRestoreJobsClient.NewListPager +// method. +func (client *CrossRegionRestoreJobsClient) NewListPager(resourceGroupName string, location string, parameters CrossRegionRestoreJobsRequest, options *CrossRegionRestoreJobsClientListOptions) *runtime.Pager[CrossRegionRestoreJobsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[CrossRegionRestoreJobsClientListResponse]{ + More: func(page CrossRegionRestoreJobsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CrossRegionRestoreJobsClientListResponse) (CrossRegionRestoreJobsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, location, parameters, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CrossRegionRestoreJobsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CrossRegionRestoreJobsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CrossRegionRestoreJobsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *CrossRegionRestoreJobsClient) listCreateRequest(ctx context.Context, resourceGroupName string, location string, parameters CrossRegionRestoreJobsRequest, options *CrossRegionRestoreJobsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchCrossRegionRestoreJobs" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// listHandleResponse handles the List response. +func (client *CrossRegionRestoreJobsClient) listHandleResponse(resp *http.Response) (CrossRegionRestoreJobsClientListResponse, error) { + result := CrossRegionRestoreJobsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBackupJobResourceList); err != nil { + return CrossRegionRestoreJobsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client.go index 49112d51b22d..4b032bf658d5 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -47,25 +46,28 @@ func NewDeletedBackupInstancesClient(subscriptionID string, credential azcore.To // Get - Gets a deleted backup instance with name in a backup vault // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { return DeletedBackupInstancesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DeletedBackupInstancesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DeletedBackupInstancesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeletedBackupInstancesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -89,7 +91,7 @@ func (client *DeletedBackupInstancesClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -106,7 +108,7 @@ func (client *DeletedBackupInstancesClient) getHandleResponse(resp *http.Respons // NewListPager - Gets deleted backup instances belonging to a backup vault // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - options - DeletedBackupInstancesClientListOptions contains the optional parameters for the DeletedBackupInstancesClient.NewListPager @@ -156,7 +158,7 @@ func (client *DeletedBackupInstancesClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -174,7 +176,7 @@ func (client *DeletedBackupInstancesClient) listHandleResponse(resp *http.Respon // BeginUndelete - // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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 @@ -186,7 +188,8 @@ func (client *DeletedBackupInstancesClient) BeginUndelete(ctx context.Context, r if err != nil { return nil, err } - return runtime.NewPoller[DeletedBackupInstancesClientUndeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DeletedBackupInstancesClientUndeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DeletedBackupInstancesClientUndeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -195,20 +198,22 @@ func (client *DeletedBackupInstancesClient) BeginUndelete(ctx context.Context, r // Undelete - // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *DeletedBackupInstancesClient) undelete(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, options *DeletedBackupInstancesClientBeginUndeleteOptions) (*http.Response, error) { + var err error req, err := client.undeleteCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // undeleteCreateRequest creates the Undelete request. @@ -232,7 +237,7 @@ func (client *DeletedBackupInstancesClient) undeleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client_example_test.go deleted file mode 100644 index 570fc2e6f478..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client_example_test.go +++ /dev/null @@ -1,167 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json -func ExampleDeletedBackupInstancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDeletedBackupInstancesClient().NewListPager("000pikumar", "PratikPrivatePreviewVault1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DeletedBackupInstanceResourceList = armdataprotection.DeletedBackupInstanceResourceList{ - // Value: []*armdataprotection.DeletedBackupInstanceResource{ - // { - // Name: to.Ptr("testInstance1"), - // Type: to.Ptr("Microsoft.DataProtection/backupVaults/deletedBackupInstances"), - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/backupVaults/PratikPrivatePreviewVault1/deletedBackupInstances/testInstance1"), - // Properties: &armdataprotection.DeletedBackupInstance{ - // 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(""), - // }, - // FriendlyName: to.Ptr("testInstance1"), - // ObjectType: to.Ptr("DeletedBackupInstance"), - // PolicyInfo: &armdataprotection.PolicyInfo{ - // PolicyID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/backupVaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1"), - // }, - // ProtectionStatus: &armdataprotection.ProtectionStatusDetails{ - // Status: to.Ptr(armdataprotection.StatusSoftDeleted), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // DeletionInfo: &armdataprotection.DeletionInfo{ - // BillingEndDate: to.Ptr("2022-05-06T00:00:36.6660445Z"), - // DeleteActivityID: to.Ptr("1e9ec790-d198-4efb-bbd7-e4669d5351a4"), - // DeletionTime: to.Ptr("2022-05-04T00:00:36.6660445Z"), - // ScheduledPurgeTime: to.Ptr("2022-05-20T00:00:36.6660445Z"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json -func ExampleDeletedBackupInstancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDeletedBackupInstancesClient().Get(ctx, "000pikumar", "PratikPrivatePreviewVault1", "testInstance1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeletedBackupInstanceResource = armdataprotection.DeletedBackupInstanceResource{ - // Name: to.Ptr("testInstance1"), - // Type: to.Ptr("Microsoft.DataProtection/backupVaults/deletedBackupInstances"), - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/backupVaults/PratikPrivatePreviewVault1/deletedBackupInstances/testInstance1"), - // Properties: &armdataprotection.DeletedBackupInstance{ - // 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(""), - // }, - // FriendlyName: to.Ptr("testInstance1"), - // ObjectType: to.Ptr("DeletedBackupInstance"), - // PolicyInfo: &armdataprotection.PolicyInfo{ - // PolicyID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/backupVaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1"), - // }, - // ProtectionStatus: &armdataprotection.ProtectionStatusDetails{ - // Status: to.Ptr(armdataprotection.StatusSoftDeleted), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // DeletionInfo: &armdataprotection.DeletionInfo{ - // BillingEndDate: to.Ptr("2022-05-06T00:00:36.6660445Z"), - // DeleteActivityID: to.Ptr("1e9ec790-d198-4efb-bbd7-e4669d5351a4"), - // DeletionTime: to.Ptr("2022-05-04T00:00:36.6660445Z"), - // ScheduledPurgeTime: to.Ptr("2022-05-20T00:00:36.6660445Z"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json -func ExampleDeletedBackupInstancesClient_BeginUndelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeletedBackupInstancesClient().BeginUndelete(ctx, "testrg", "testvault", "testbi", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/dppresourceguardproxy_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/dppresourceguardproxy_client.go index 7c78c3598fd0..5841b35ef8e5 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/dppresourceguardproxy_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/dppresourceguardproxy_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -47,7 +46,7 @@ func NewDppResourceGuardProxyClient(subscriptionID string, credential azcore.Tok // CreateOrUpdate - Creates or Updates a ResourceGuardProxy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - resourceGuardProxyName - name of the resource guard proxy @@ -55,18 +54,21 @@ func NewDppResourceGuardProxyClient(subscriptionID string, credential azcore.Tok // - options - DppResourceGuardProxyClientCreateOrUpdateOptions contains the optional parameters for the DppResourceGuardProxyClient.CreateOrUpdate // method. func (client *DppResourceGuardProxyClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, resourceGuardProxyName string, parameters ResourceGuardProxyBaseResource, options *DppResourceGuardProxyClientCreateOrUpdateOptions) (DppResourceGuardProxyClientCreateOrUpdateResponse, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vaultName, resourceGuardProxyName, parameters, options) if err != nil { return DppResourceGuardProxyClientCreateOrUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DppResourceGuardProxyClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DppResourceGuardProxyClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DppResourceGuardProxyClientCreateOrUpdateResponse{}, err } - return client.createOrUpdateHandleResponse(resp) + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -90,10 +92,13 @@ func (client *DppResourceGuardProxyClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -108,23 +113,25 @@ func (client *DppResourceGuardProxyClient) createOrUpdateHandleResponse(resp *ht // Delete - Deletes the ResourceGuardProxy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - resourceGuardProxyName - name of the resource guard proxy // - options - DppResourceGuardProxyClientDeleteOptions contains the optional parameters for the DppResourceGuardProxyClient.Delete // method. func (client *DppResourceGuardProxyClient) Delete(ctx context.Context, resourceGroupName string, vaultName string, resourceGuardProxyName string, options *DppResourceGuardProxyClientDeleteOptions) (DppResourceGuardProxyClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, resourceGuardProxyName, options) if err != nil { return DppResourceGuardProxyClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DppResourceGuardProxyClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return DppResourceGuardProxyClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DppResourceGuardProxyClientDeleteResponse{}, err } return DppResourceGuardProxyClientDeleteResponse{}, nil } @@ -150,7 +157,7 @@ func (client *DppResourceGuardProxyClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -159,25 +166,28 @@ func (client *DppResourceGuardProxyClient) deleteCreateRequest(ctx context.Conte // Get - Returns the ResourceGuardProxy object associated with the vault, and that matches the name in the request // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - resourceGuardProxyName - name of the resource guard proxy // - options - DppResourceGuardProxyClientGetOptions contains the optional parameters for the DppResourceGuardProxyClient.Get // method. func (client *DppResourceGuardProxyClient) Get(ctx context.Context, resourceGroupName string, vaultName string, resourceGuardProxyName string, options *DppResourceGuardProxyClientGetOptions) (DppResourceGuardProxyClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, resourceGuardProxyName, options) if err != nil { return DppResourceGuardProxyClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DppResourceGuardProxyClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DppResourceGuardProxyClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DppResourceGuardProxyClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -201,7 +211,7 @@ func (client *DppResourceGuardProxyClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -218,7 +228,7 @@ func (client *DppResourceGuardProxyClient) getHandleResponse(resp *http.Response // NewListPager - Returns the list of ResourceGuardProxies associated with the vault // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - options - DppResourceGuardProxyClientListOptions contains the optional parameters for the DppResourceGuardProxyClient.NewListPager @@ -268,7 +278,7 @@ func (client *DppResourceGuardProxyClient) listCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -286,7 +296,7 @@ func (client *DppResourceGuardProxyClient) listHandleResponse(resp *http.Respons // UnlockDelete - UnlockDelete call for ResourceGuardProxy, executed before one can delete it // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - resourceGuardProxyName - name of the resource guard proxy @@ -294,18 +304,21 @@ func (client *DppResourceGuardProxyClient) listHandleResponse(resp *http.Respons // - options - DppResourceGuardProxyClientUnlockDeleteOptions contains the optional parameters for the DppResourceGuardProxyClient.UnlockDelete // method. func (client *DppResourceGuardProxyClient) UnlockDelete(ctx context.Context, resourceGroupName string, vaultName string, resourceGuardProxyName string, parameters UnlockDeleteRequest, options *DppResourceGuardProxyClientUnlockDeleteOptions) (DppResourceGuardProxyClientUnlockDeleteResponse, error) { + var err error req, err := client.unlockDeleteCreateRequest(ctx, resourceGroupName, vaultName, resourceGuardProxyName, parameters, options) if err != nil { return DppResourceGuardProxyClientUnlockDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DppResourceGuardProxyClientUnlockDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DppResourceGuardProxyClientUnlockDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DppResourceGuardProxyClientUnlockDeleteResponse{}, err } - return client.unlockDeleteHandleResponse(resp) + resp, err := client.unlockDeleteHandleResponse(httpResp) + return resp, err } // unlockDeleteCreateRequest creates the UnlockDelete request. @@ -329,10 +342,13 @@ func (client *DppResourceGuardProxyClient) unlockDeleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // unlockDeleteHandleResponse handles the UnlockDelete response. diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/dppresourceguardproxy_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/dppresourceguardproxy_client_example_test.go deleted file mode 100644 index aa51eb9f6a5e..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/dppresourceguardproxy_client_example_test.go +++ /dev/null @@ -1,192 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json -func ExampleDppResourceGuardProxyClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDppResourceGuardProxyClient().NewListPager("SampleResourceGroup", "sampleVault", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceGuardProxyBaseResourceList = armdataprotection.ResourceGuardProxyBaseResourceList{ - // Value: []*armdataprotection.ResourceGuardProxyBaseResource{ - // { - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.DataProtection/vaults/backupResourceGuardProxies"), - // ID: to.Ptr("/subscriptions/5e13b949-1218-4d18-8b99-7e12155ec4f7/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/backupVaults/sampleVault/backupResourceGuardProxies/swaggerExample"), - // Properties: &armdataprotection.ResourceGuardProxyBase{ - // Description: to.Ptr("Please take JIT access before performing any of the critical operation"), - // LastUpdatedTime: to.Ptr("2022-09-16T11:44:37.6130487Z"), - // ResourceGuardOperationDetails: []*armdataprotection.ResourceGuardOperationDetail{ - // { - // DefaultResourceRequest: to.Ptr("/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource/deleteBackupInstanceRequests/default"), - // VaultCriticalOperation: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/delete"), - // }, - // { - // DefaultResourceRequest: to.Ptr("/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource/deleteResourceGuardProxyRequests/default"), - // VaultCriticalOperation: to.Ptr("Microsoft.DataProtection/backupVaults/backupResourceGuardProxies/delete"), - // }}, - // ResourceGuardResourceID: to.Ptr("/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json -func ExampleDppResourceGuardProxyClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDppResourceGuardProxyClient().Get(ctx, "SampleResourceGroup", "sampleVault", "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ResourceGuardProxyBaseResource = armdataprotection.ResourceGuardProxyBaseResource{ - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.DataProtection/vaults/backupResourceGuardProxies"), - // ID: to.Ptr("/subscriptions/5e13b949-1218-4d18-8b99-7e12155ec4f7/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/backupVaults/sampleVault/backupResourceGuardProxies/swaggerExample"), - // Properties: &armdataprotection.ResourceGuardProxyBase{ - // Description: to.Ptr("Please take JIT access before performing any of the critical operation"), - // LastUpdatedTime: to.Ptr("2022-09-16T11:44:37.6130487Z"), - // ResourceGuardOperationDetails: []*armdataprotection.ResourceGuardOperationDetail{ - // { - // DefaultResourceRequest: to.Ptr("/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource/deleteBackupInstanceRequests/default"), - // VaultCriticalOperation: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/delete"), - // }, - // { - // DefaultResourceRequest: to.Ptr("/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource/deleteResourceGuardProxyRequests/default"), - // VaultCriticalOperation: to.Ptr("Microsoft.DataProtection/backupVaults/backupResourceGuardProxies/delete"), - // }}, - // ResourceGuardResourceID: to.Ptr("/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json -func ExampleDppResourceGuardProxyClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDppResourceGuardProxyClient().CreateOrUpdate(ctx, "SampleResourceGroup", "sampleVault", "swaggerExample", armdataprotection.ResourceGuardProxyBaseResource{ - Properties: &armdataprotection.ResourceGuardProxyBase{ - ResourceGuardResourceID: to.Ptr("/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ResourceGuardProxyBaseResource = armdataprotection.ResourceGuardProxyBaseResource{ - // Name: to.Ptr("swaggerExample"), - // Type: to.Ptr("Microsoft.DataProtection/vaults/backupResourceGuardProxies"), - // ID: to.Ptr("/subscriptions/5e13b949-1218-4d18-8b99-7e12155ec4f7/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/backupVaults/sampleVault/backupResourceGuardProxies/swaggerExample"), - // Properties: &armdataprotection.ResourceGuardProxyBase{ - // Description: to.Ptr("Please take JIT access before performing any of the critical operation"), - // LastUpdatedTime: to.Ptr("2022-09-16T11:44:37.6130487Z"), - // ResourceGuardOperationDetails: []*armdataprotection.ResourceGuardOperationDetail{ - // { - // DefaultResourceRequest: to.Ptr("/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource/deleteBackupInstanceRequests/default"), - // VaultCriticalOperation: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/delete"), - // }, - // { - // DefaultResourceRequest: to.Ptr("/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource/deleteResourceGuardProxyRequests/default"), - // VaultCriticalOperation: to.Ptr("Microsoft.DataProtection/backupVaults/backupResourceGuardProxies/delete"), - // }}, - // ResourceGuardResourceID: to.Ptr("/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json -func ExampleDppResourceGuardProxyClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDppResourceGuardProxyClient().Delete(ctx, "SampleResourceGroup", "sampleVault", "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json -func ExampleDppResourceGuardProxyClient_UnlockDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDppResourceGuardProxyClient().UnlockDelete(ctx, "SampleResourceGroup", "sampleVault", "swaggerExample", armdataprotection.UnlockDeleteRequest{ - ResourceGuardOperationRequests: []*string{ - to.Ptr("/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource/deleteBackupInstanceRequests/default")}, - ResourceToBeDeleted: to.Ptr("/subscriptions/5e13b949-1218-4d18-8b99-7e12155ec4f7/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/backupVaults/sampleVault/backupInstances/TestBI9779f4de"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.UnlockDeleteResponse = armdataprotection.UnlockDeleteResponse{ - // UnlockDeleteExpiryTime: to.Ptr("2022-09-16T12:50:10.7039695Z"), - // } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client.go index bc6873de3eb7..92d7e94dc432 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -47,7 +46,7 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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. @@ -57,9 +56,10 @@ func (client *ExportJobsClient) BeginTrigger(ctx context.Context, resourceGroupN if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExportJobsClientTriggerResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExportJobsClientTriggerResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ExportJobsClientTriggerResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -68,20 +68,22 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview func (client *ExportJobsClient) trigger(ctx context.Context, resourceGroupName string, vaultName string, options *ExportJobsClientBeginTriggerOptions) (*http.Response, error) { + var err error req, err := client.triggerCreateRequest(ctx, resourceGroupName, vaultName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // triggerCreateRequest creates the Trigger request. @@ -101,7 +103,7 @@ func (client *ExportJobsClient) triggerCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client_example_test.go deleted file mode 100644 index a32b697c436a..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/exportjobs_client_example_test.go +++ /dev/null @@ -1,39 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExportJobsClient().BeginTrigger(ctx, "SwaggerTestRg", "NetSDKTestRsVault", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client.go index f04608bd0035..30c7dad53ef5 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -49,25 +48,28 @@ func NewExportJobsOperationResultClient(subscriptionID string, credential azcore // jobs in JSON serialized format. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - operationID - OperationID which represents the export job. // - options - ExportJobsOperationResultClientGetOptions contains the optional parameters for the ExportJobsOperationResultClient.Get // method. func (client *ExportJobsOperationResultClient) Get(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *ExportJobsOperationResultClientGetOptions) (ExportJobsOperationResultClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, operationID, options) if err != nil { return ExportJobsOperationResultClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ExportJobsOperationResultClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return ExportJobsOperationResultClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return ExportJobsOperationResultClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -91,7 +93,7 @@ func (client *ExportJobsOperationResultClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client_example_test.go deleted file mode 100644 index 77bf9c1d347a..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/exportjobsoperationresult_client_example_test.go +++ /dev/null @@ -1,44 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExportJobsOperationResultClient().Get(ctx, "SwaggerTestRg", "NetSDKTestRsVault", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExportJobsResult = armdataprotection.ExportJobsResult{ - // BlobSasKey: to.Ptr("someKey"), - // BlobURL: to.Ptr("https://azureblob.blob.core.windows.net/reportcontainer/exportjobsreport00000000-0000-0000-0000-000000000000"), - // ExcelFileBlobSasKey: to.Ptr("someKey"), - // ExcelFileBlobURL: to.Ptr("https://azureblob.blob.core.windows.net/reportcontainer/exportjobsreport00000000-0000-0000-0000-000000000000_ExcelFile.xlsx"), - // } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/go.mod b/sdk/resourcemanager/dataprotection/armdataprotection/go.mod index daa213aaf5dd..eeebc724b9da 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/v2 +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v3 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.7.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/go.sum b/sdk/resourcemanager/dataprotection/armdataprotection/go.sum index 21718b486698..727ce838bdc8 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/go.sum +++ b/sdk/resourcemanager/dataprotection/armdataprotection/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 h1:8kDqDngH+DmVBiCtIjCFTGa7MBnsIOkF9IccInFEbjk= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= -github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= -github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +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.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/interfaces.go b/sdk/resourcemanager/dataprotection/armdataprotection/interfaces.go new file mode 100644 index 000000000000..c9fc90f9ca92 --- /dev/null +++ b/sdk/resourcemanager/dataprotection/armdataprotection/interfaces.go @@ -0,0 +1,183 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdataprotection + +// AuthCredentialsClassification provides polymorphic access to related types. +// Call the interface's GetAuthCredentials() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AuthCredentials, *SecretStoreBasedAuthCredentials +type AuthCredentialsClassification interface { + // GetAuthCredentials returns the AuthCredentials content of the underlying type. + GetAuthCredentials() *AuthCredentials +} + +// AzureBackupRecoveryPointClassification provides polymorphic access to related types. +// Call the interface's GetAzureBackupRecoveryPoint() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureBackupDiscreteRecoveryPoint, *AzureBackupRecoveryPoint +type AzureBackupRecoveryPointClassification interface { + // GetAzureBackupRecoveryPoint returns the AzureBackupRecoveryPoint content of the underlying type. + GetAzureBackupRecoveryPoint() *AzureBackupRecoveryPoint +} + +// AzureBackupRecoveryPointBasedRestoreRequestClassification provides polymorphic access to related types. +// Call the interface's GetAzureBackupRecoveryPointBasedRestoreRequest() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureBackupRecoveryPointBasedRestoreRequest, *AzureBackupRestoreWithRehydrationRequest +type AzureBackupRecoveryPointBasedRestoreRequestClassification interface { + AzureBackupRestoreRequestClassification + // GetAzureBackupRecoveryPointBasedRestoreRequest returns the AzureBackupRecoveryPointBasedRestoreRequest content of the underlying type. + GetAzureBackupRecoveryPointBasedRestoreRequest() *AzureBackupRecoveryPointBasedRestoreRequest +} + +// AzureBackupRestoreRequestClassification provides polymorphic access to related types. +// Call the interface's GetAzureBackupRestoreRequest() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureBackupRecoveryPointBasedRestoreRequest, *AzureBackupRecoveryTimeBasedRestoreRequest, *AzureBackupRestoreRequest, +// - *AzureBackupRestoreWithRehydrationRequest +type AzureBackupRestoreRequestClassification interface { + // GetAzureBackupRestoreRequest returns the AzureBackupRestoreRequest content of the underlying type. + GetAzureBackupRestoreRequest() *AzureBackupRestoreRequest +} + +// BackupCriteriaClassification provides polymorphic access to related types. +// Call the interface's GetBackupCriteria() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *BackupCriteria, *ScheduleBasedBackupCriteria +type BackupCriteriaClassification interface { + // GetBackupCriteria returns the BackupCriteria content of the underlying type. + GetBackupCriteria() *BackupCriteria +} + +// BackupDatasourceParametersClassification provides polymorphic access to related types. +// Call the interface's GetBackupDatasourceParameters() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *BackupDatasourceParameters, *BlobBackupDatasourceParameters, *KubernetesClusterBackupDatasourceParameters +type BackupDatasourceParametersClassification interface { + // GetBackupDatasourceParameters returns the BackupDatasourceParameters content of the underlying type. + GetBackupDatasourceParameters() *BackupDatasourceParameters +} + +// BackupParametersClassification provides polymorphic access to related types. +// Call the interface's GetBackupParameters() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureBackupParams, *BackupParameters +type BackupParametersClassification interface { + // GetBackupParameters returns the BackupParameters content of the underlying type. + GetBackupParameters() *BackupParameters +} + +// BaseBackupPolicyClassification provides polymorphic access to related types. +// Call the interface's GetBaseBackupPolicy() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *BackupPolicy, *BaseBackupPolicy +type BaseBackupPolicyClassification interface { + // GetBaseBackupPolicy returns the BaseBackupPolicy content of the underlying type. + GetBaseBackupPolicy() *BaseBackupPolicy +} + +// BasePolicyRuleClassification provides polymorphic access to related types. +// Call the interface's GetBasePolicyRule() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureBackupRule, *AzureRetentionRule, *BasePolicyRule +type BasePolicyRuleClassification interface { + // GetBasePolicyRule returns the BasePolicyRule content of the underlying type. + GetBasePolicyRule() *BasePolicyRule +} + +// BaseResourcePropertiesClassification provides polymorphic access to related types. +// Call the interface's GetBaseResourceProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *BaseResourceProperties, *DefaultResourceProperties +type BaseResourcePropertiesClassification interface { + // GetBaseResourceProperties returns the BaseResourceProperties content of the underlying type. + GetBaseResourceProperties() *BaseResourceProperties +} + +// CopyOptionClassification provides polymorphic access to related types. +// Call the interface's GetCopyOption() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *CopyOnExpiryOption, *CopyOption, *CustomCopyOption, *ImmediateCopyOption +type CopyOptionClassification interface { + // GetCopyOption returns the CopyOption content of the underlying type. + GetCopyOption() *CopyOption +} + +// DataStoreParametersClassification provides polymorphic access to related types. +// Call the interface's GetDataStoreParameters() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureOperationalStoreParameters, *DataStoreParameters +type DataStoreParametersClassification interface { + // GetDataStoreParameters returns the DataStoreParameters content of the underlying type. + GetDataStoreParameters() *DataStoreParameters +} + +// DeleteOptionClassification provides polymorphic access to related types. +// Call the interface's GetDeleteOption() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AbsoluteDeleteOption, *DeleteOption +type DeleteOptionClassification interface { + // GetDeleteOption returns the DeleteOption content of the underlying type. + GetDeleteOption() *DeleteOption +} + +// FeatureValidationRequestBaseClassification provides polymorphic access to related types. +// Call the interface's GetFeatureValidationRequestBase() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *FeatureValidationRequest, *FeatureValidationRequestBase +type FeatureValidationRequestBaseClassification interface { + // GetFeatureValidationRequestBase returns the FeatureValidationRequestBase content of the underlying type. + GetFeatureValidationRequestBase() *FeatureValidationRequestBase +} + +// FeatureValidationResponseBaseClassification provides polymorphic access to related types. +// Call the interface's GetFeatureValidationResponseBase() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *FeatureValidationResponse, *FeatureValidationResponseBase +type FeatureValidationResponseBaseClassification interface { + // GetFeatureValidationResponseBase returns the FeatureValidationResponseBase content of the underlying type. + GetFeatureValidationResponseBase() *FeatureValidationResponseBase +} + +// ItemLevelRestoreCriteriaClassification provides polymorphic access to related types. +// Call the interface's GetItemLevelRestoreCriteria() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ItemLevelRestoreCriteria, *ItemPathBasedRestoreCriteria, *KubernetesClusterRestoreCriteria, *KubernetesPVRestoreCriteria, +// - *KubernetesStorageClassRestoreCriteria, *RangeBasedItemLevelRestoreCriteria +type ItemLevelRestoreCriteriaClassification interface { + // GetItemLevelRestoreCriteria returns the ItemLevelRestoreCriteria content of the underlying type. + GetItemLevelRestoreCriteria() *ItemLevelRestoreCriteria +} + +// OperationExtendedInfoClassification provides polymorphic access to related types. +// Call the interface's GetOperationExtendedInfo() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *OperationExtendedInfo, *OperationJobExtendedInfo +type OperationExtendedInfoClassification interface { + // GetOperationExtendedInfo returns the OperationExtendedInfo content of the underlying type. + GetOperationExtendedInfo() *OperationExtendedInfo +} + +// RestoreTargetInfoBaseClassification provides polymorphic access to related types. +// Call the interface's GetRestoreTargetInfoBase() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ItemLevelRestoreTargetInfo, *RestoreFilesTargetInfo, *RestoreTargetInfo, *RestoreTargetInfoBase +type RestoreTargetInfoBaseClassification interface { + // GetRestoreTargetInfoBase returns the RestoreTargetInfoBase content of the underlying type. + GetRestoreTargetInfoBase() *RestoreTargetInfoBase +} + +// TriggerContextClassification provides polymorphic access to related types. +// Call the interface's GetTriggerContext() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AdhocBasedTriggerContext, *ScheduleBasedTriggerContext, *TriggerContext +type TriggerContextClassification interface { + // GetTriggerContext returns the TriggerContext content of the underlying type. + GetTriggerContext() *TriggerContext +} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/jobs_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/jobs_client.go index 1b73de0f4d41..dc1d54c57640 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/jobs_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/jobs_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -44,27 +43,93 @@ func NewJobsClient(subscriptionID string, credential azcore.TokenCredential, opt return client, nil } +// GenerateProgressURL - Generates read SAS URL for a blob from which current job progress can be read. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - 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 - JobsClientGenerateProgressURLOptions contains the optional parameters for the JobsClient.GenerateProgressURL +// method. +func (client *JobsClient) GenerateProgressURL(ctx context.Context, resourceGroupName string, vaultName string, jobID string, options *JobsClientGenerateProgressURLOptions) (JobsClientGenerateProgressURLResponse, error) { + var err error + req, err := client.generateProgressURLCreateRequest(ctx, resourceGroupName, vaultName, jobID, options) + if err != nil { + return JobsClientGenerateProgressURLResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return JobsClientGenerateProgressURLResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JobsClientGenerateProgressURLResponse{}, err + } + resp, err := client.generateProgressURLHandleResponse(httpResp) + return resp, err +} + +// generateProgressURLCreateRequest creates the GenerateProgressURL request. +func (client *JobsClient) generateProgressURLCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, jobID string, options *JobsClientGenerateProgressURLOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}/generateProgressUrl" + 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 jobID == "" { + return nil, errors.New("parameter jobID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobId}", url.PathEscape(jobID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// generateProgressURLHandleResponse handles the GenerateProgressURL response. +func (client *JobsClient) generateProgressURLHandleResponse(resp *http.Response) (JobsClientGenerateProgressURLResponse, error) { + result := JobsClientGenerateProgressURLResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBackupJobProgressURL); err != nil { + return JobsClientGenerateProgressURLResponse{}, err + } + return result, nil +} + // Get - Gets a job with id in a backup vault // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - jobID - The Job ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). // - options - JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. func (client *JobsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, jobID string, options *JobsClientGetOptions) (JobsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, jobID, options) if err != nil { return JobsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return JobsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return JobsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return JobsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -88,7 +153,7 @@ func (client *JobsClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -105,7 +170,7 @@ func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsClientGetR // NewListPager - Returns list of jobs belonging to a backup vault // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - options - JobsClientListOptions contains the optional parameters for the JobsClient.NewListPager method. @@ -154,7 +219,7 @@ func (client *JobsClient) listCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -168,3 +233,74 @@ func (client *JobsClient) listHandleResponse(resp *http.Response) (JobsClientLis } return result, nil } + +// BeginTriggerCancel - Triggers cancellation of Job and returns an OperationID to track. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +// - 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 - JobsClientBeginTriggerCancelOptions contains the optional parameters for the JobsClient.BeginTriggerCancel method. +func (client *JobsClient) BeginTriggerCancel(ctx context.Context, resourceGroupName string, vaultName string, jobID string, options *JobsClientBeginTriggerCancelOptions) (*runtime.Poller[JobsClientTriggerCancelResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.triggerCancel(ctx, resourceGroupName, vaultName, jobID, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[JobsClientTriggerCancelResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[JobsClientTriggerCancelResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// TriggerCancel - Triggers cancellation of Job and returns an OperationID to track. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-06-01-preview +func (client *JobsClient) triggerCancel(ctx context.Context, resourceGroupName string, vaultName string, jobID string, options *JobsClientBeginTriggerCancelOptions) (*http.Response, error) { + var err error + req, err := client.triggerCancelCreateRequest(ctx, resourceGroupName, vaultName, jobID, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// triggerCancelCreateRequest creates the TriggerCancel request. +func (client *JobsClient) triggerCancelCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, jobID string, options *JobsClientBeginTriggerCancelOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}/triggerCancel" + 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 jobID == "" { + return nil, errors.New("parameter jobID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobId}", url.PathEscape(jobID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/jobs_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/jobs_client_example_test.go deleted file mode 100644 index 21c69c858ba6..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/jobs_client_example_test.go +++ /dev/null @@ -1,230 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewJobsClient().NewListPager("BugBash1", "BugBashVaultForCCYv11", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureBackupJobResourceList = armdataprotection.AzureBackupJobResourceList{ - // Value: []*armdataprotection.AzureBackupJobResource{ - // { - // Name: to.Ptr("8989416e-7573-4836-8cf1-0e90954f1002"), - // Type: to.Ptr("Microsoft.DataProtection/Backupvaults/backupJobs"), - // ID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/Backupvaults/BugBashVaultForCCYv11/backupJobs/8989416e-7573-4836-8cf1-0e90954f1002"), - // Properties: &armdataprotection.AzureBackupJob{ - // ActivityID: to.Ptr("932925c4-3d81-4550-8105-c7f7b0a934c5"), - // BackupInstanceFriendlyName: to.Ptr("mabtestingccybasicv11\\bugbashdb4"), - // BackupInstanceID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/backupVaults/BugBashVaultForCCYv11/backupInstances/3048870f-b1b7-44c4-b078-368da3fd000e"), - // DataSourceID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/DppPostgresTestingCcy/providers/Microsoft.DBforPostgreSQL/servers/mabtestingccybasicv11/databases/bugbashdb4"), - // DataSourceLocation: to.Ptr("centraluseuap"), - // DataSourceName: to.Ptr("bugbashdb4"), - // DataSourceSetName: to.Ptr("mabtestingccybasicv11"), - // DataSourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - // Duration: to.Ptr("00:00:00"), - // IsUserTriggered: to.Ptr(false), - // Operation: to.Ptr("Backup"), - // OperationCategory: to.Ptr("Backup"), - // PolicyID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/backupVaults/BugBashVaultForCCYv11/backupPolicies/jakavetPolicy2"), - // PolicyName: to.Ptr("jakavetPolicy2"), - // ProgressEnabled: to.Ptr(false), - // SourceResourceGroup: to.Ptr("DppPostgresTestingCcy"), - // SourceSubscriptionID: to.Ptr("62b829ee-7936-40c9-a1c9-47a93f9f3965"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-16T05:00:08.1746833Z"); return t}()), - // Status: to.Ptr("Started"), - // SubscriptionID: to.Ptr("62b829ee-7936-40c9-a1c9-47a93f9f3965"), - // SupportedActions: []*string{ - // }, - // VaultName: to.Ptr("BugBashVaultForCCYv11"), - // }, - // }, - // { - // Name: to.Ptr("ad218c05-242a-47c2-b7b7-c16bd0f8870c"), - // Type: to.Ptr("Microsoft.DataProtection/Backupvaults/backupJobs"), - // ID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/Backupvaults/BugBashVaultForCCYv11/backupJobs/ad218c05-242a-47c2-b7b7-c16bd0f8870c"), - // Properties: &armdataprotection.AzureBackupJob{ - // ActivityID: to.Ptr("b4f32e03-ded0-46fc-9afc-91853878efcd"), - // BackupInstanceFriendlyName: to.Ptr("mabtestingccybasicv11\\bugbashdb5"), - // BackupInstanceID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/backupVaults/BugBashVaultForCCYv11/backupInstances/943c60db-c033-4d93-bb00-66048474e00e"), - // DataSourceID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/DppPostgresTestingCcy/providers/Microsoft.DBforPostgreSQL/servers/mabtestingccybasicv11/databases/bugbashdb5"), - // DataSourceLocation: to.Ptr("centraluseuap"), - // DataSourceName: to.Ptr("bugbashdb5"), - // DataSourceSetName: to.Ptr("mabtestingccybasicv11"), - // DataSourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - // Duration: to.Ptr("00:00:00"), - // IsUserTriggered: to.Ptr(false), - // Operation: to.Ptr("Backup"), - // OperationCategory: to.Ptr("Backup"), - // PolicyID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/backupVaults/BugBashVaultForCCYv11/backupPolicies/jakavetPolicy3"), - // PolicyName: to.Ptr("jakavetPolicy3"), - // ProgressEnabled: to.Ptr(false), - // SourceResourceGroup: to.Ptr("DppPostgresTestingCcy"), - // SourceSubscriptionID: to.Ptr("62b829ee-7936-40c9-a1c9-47a93f9f3965"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-16T18:00:03.6660733Z"); return t}()), - // Status: to.Ptr("Started"), - // SubscriptionID: to.Ptr("62b829ee-7936-40c9-a1c9-47a93f9f3965"), - // SupportedActions: []*string{ - // }, - // VaultName: to.Ptr("BugBashVaultForCCYv11"), - // }, - // }, - // { - // Name: to.Ptr("3c60cb49-63e8-4b21-b9bd-26277b3fdfae"), - // Type: to.Ptr("Microsoft.DataProtection/Backupvaults/backupJobs"), - // ID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/Backupvaults/BugBashVaultForCCYv11/backupJobs/3c60cb49-63e8-4b21-b9bd-26277b3fdfae"), - // Properties: &armdataprotection.AzureBackupJob{ - // ActivityID: to.Ptr("c4344fb4-7c11-43a4-8307-7ae7c7fb09b9"), - // BackupInstanceFriendlyName: to.Ptr("mabtestingccybasicv11\\bugbashdb2"), - // BackupInstanceID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/backupVaults/BugBashVaultForCCYv11/backupInstances/28460a9d-707a-45f3-ace6-b16284c2900e"), - // DataSourceID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/DppPostgresTestingCcy/providers/Microsoft.DBforPostgreSQL/servers/mabtestingccybasicv11/databases/bugbashdb2"), - // DataSourceLocation: to.Ptr("centraluseuap"), - // DataSourceName: to.Ptr("bugbashdb2"), - // DataSourceSetName: to.Ptr("mabtestingccybasicv11"), - // DataSourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - // Duration: to.Ptr("00:00:00"), - // IsUserTriggered: to.Ptr(false), - // Operation: to.Ptr("Backup"), - // OperationCategory: to.Ptr("Backup"), - // PolicyID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/backupVaults/BugBashVaultForCCYv11/backupPolicies/jakavetdailypolicy"), - // PolicyName: to.Ptr("jakavetdailypolicy"), - // ProgressEnabled: to.Ptr(false), - // SourceResourceGroup: to.Ptr("DppPostgresTestingCcy"), - // SourceSubscriptionID: to.Ptr("62b829ee-7936-40c9-a1c9-47a93f9f3965"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-17T03:00:03.7604146Z"); return t}()), - // Status: to.Ptr("Started"), - // SubscriptionID: to.Ptr("62b829ee-7936-40c9-a1c9-47a93f9f3965"), - // SupportedActions: []*string{ - // }, - // VaultName: to.Ptr("BugBashVaultForCCYv11"), - // }, - // }, - // { - // Name: to.Ptr("43252662-1b43-44fd-a856-0055665cb097"), - // Type: to.Ptr("Microsoft.DataProtection/Backupvaults/backupJobs"), - // ID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/Backupvaults/BugBashVaultForCCYv11/backupJobs/43252662-1b43-44fd-a856-0055665cb097"), - // Properties: &armdataprotection.AzureBackupJob{ - // ActivityID: to.Ptr("94052cf1-a47f-4c1b-93e7-79e07b2bd008-Tue Mar 17 2021 11:11:48 GMT+0530 (India Standard Time)-Ibz"), - // BackupInstanceFriendlyName: to.Ptr("mabtestingccybasicv11\\bugbashdb3"), - // BackupInstanceID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/backupVaults/BugBashVaultForCCYv11/backupInstances/0b247869-b8be-4885-b832-8ac4cdf5b00e"), - // DataSourceID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/DppPostgresTestingCcy/providers/Microsoft.DBforPostgreSQL/servers/mabtestingccybasicv11/databases/bugbashdb3"), - // DataSourceLocation: to.Ptr("centraluseuap"), - // DataSourceName: to.Ptr("bugbashdb3"), - // DataSourceSetName: to.Ptr("mabtestingccybasicv11"), - // DataSourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - // Duration: to.Ptr("00:02:11.9724387"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-17T11:14:02.5319646Z"); return t}()), - // IsUserTriggered: to.Ptr(true), - // Operation: to.Ptr("Backup"), - // OperationCategory: to.Ptr("Backup"), - // PolicyID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/backupVaults/BugBashVaultForCCYv11/backupPolicies/jakavetPolicy1"), - // PolicyName: to.Ptr("jakavetPolicy1"), - // ProgressEnabled: to.Ptr(false), - // SourceResourceGroup: to.Ptr("DppPostgresTestingCcy"), - // SourceSubscriptionID: to.Ptr("62b829ee-7936-40c9-a1c9-47a93f9f3965"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-17T11:11:50.5595259Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // SubscriptionID: to.Ptr("62b829ee-7936-40c9-a1c9-47a93f9f3965"), - // SupportedActions: []*string{ - // to.Ptr("")}, - // VaultName: to.Ptr("BugBashVaultForCCYv11"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewJobsClient().Get(ctx, "BugBash1", "BugBashVaultForCCYv11", "3c60cb49-63e8-4b21-b9bd-26277b3fdfae", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureBackupJobResource = armdataprotection.AzureBackupJobResource{ - // Name: to.Ptr("3c60cb49-63e8-4b21-b9bd-26277b3fdfae"), - // Type: to.Ptr("Microsoft.DataProtection/Backupvaults/backupJobs"), - // ID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/Backupvaults/BugBashVaultForCCYv11/backupJobs/3c60cb49-63e8-4b21-b9bd-26277b3fdfae"), - // Properties: &armdataprotection.AzureBackupJob{ - // ActivityID: to.Ptr("c4344fb4-7c11-43a4-8307-7ae7c7fb09b9"), - // BackupInstanceFriendlyName: to.Ptr("mabtestingccybasicv11\\bugbashdb2"), - // BackupInstanceID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/backupVaults/BugBashVaultForCCYv11/backupInstances/28460a9d-707a-45f3-ace6-b16284c2900e"), - // DataSourceID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/DppPostgresTestingCcy/providers/Microsoft.DBforPostgreSQL/servers/mabtestingccybasicv11/databases/bugbashdb2"), - // DataSourceLocation: to.Ptr("centraluseuap"), - // DataSourceName: to.Ptr("bugbashdb2"), - // DataSourceSetName: to.Ptr("mabtestingccybasicv11"), - // DataSourceType: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - // Duration: to.Ptr("00:00:00"), - // ExtendedInfo: &armdataprotection.JobExtendedInfo{ - // AdditionalDetails: map[string]*string{ - // "PolicyRuleName": to.Ptr("BackupWeekly"), - // "RetentionTag": to.Ptr("Default"), - // "TaskId": to.Ptr("c4344fb4-7c11-43a4-8307-7ae7c7fb09b9"), - // }, - // SubTasks: []*armdataprotection.JobSubTask{ - // { - // TaskID: to.Ptr[int32](1), - // TaskName: to.Ptr("Trigger Backup"), - // TaskStatus: to.Ptr("Started"), - // }}, - // }, - // IsUserTriggered: to.Ptr(false), - // Operation: to.Ptr("Backup"), - // OperationCategory: to.Ptr("Backup"), - // PolicyID: to.Ptr("/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/BugBash1/providers/Microsoft.DataProtection/backupVaults/BugBashVaultForCCYv11/backupPolicies/jakavetdailypolicy"), - // PolicyName: to.Ptr("jakavetdailypolicy"), - // ProgressEnabled: to.Ptr(false), - // SourceResourceGroup: to.Ptr("DppPostgresTestingCcy"), - // SourceSubscriptionID: to.Ptr("62b829ee-7936-40c9-a1c9-47a93f9f3965"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-17T03:00:03.7604146Z"); return t}()), - // Status: to.Ptr("Started"), - // SubscriptionID: to.Ptr("62b829ee-7936-40c9-a1c9-47a93f9f3965"), - // SupportedActions: []*string{ - // }, - // VaultName: to.Ptr("BugBashVaultForCCYv11"), - // }, - // } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/models.go b/sdk/resourcemanager/dataprotection/armdataprotection/models.go index de92f5af4573..be6ee9bbefae 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/models.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/models.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -64,15 +63,6 @@ func (a *AdhocBasedTriggerContext) GetTriggerContext() *TriggerContext { } } -// AuthCredentialsClassification provides polymorphic access to related types. -// Call the interface's GetAuthCredentials() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AuthCredentials, *SecretStoreBasedAuthCredentials -type AuthCredentialsClassification interface { - // GetAuthCredentials returns the AuthCredentials content of the underlying type. - GetAuthCredentials() *AuthCredentials -} - // AuthCredentials - Base class for different types of authentication credentials. type AuthCredentials struct { // REQUIRED; Type of the specific object - used for deserializing @@ -252,6 +242,15 @@ type AzureBackupJob struct { // READ-ONLY; It indicates the sub type of operation i.e. in case of Restore it can be ALR/OLR RestoreType *string + + // READ-ONLY; The type of the source data store. + SourceDataStoreType *string +} + +// AzureBackupJobProgressURL - Job Progress URL class. +type AzureBackupJobProgressURL struct { + // Read SAS URI for a blob from which current job progress can be read. + ProgressURL *string } // AzureBackupJobResource - AzureBackup Job Resource Class @@ -297,15 +296,6 @@ func (a *AzureBackupParams) GetBackupParameters() *BackupParameters { } } -// AzureBackupRecoveryPointClassification provides polymorphic access to related types. -// Call the interface's GetAzureBackupRecoveryPoint() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureBackupDiscreteRecoveryPoint, *AzureBackupRecoveryPoint -type AzureBackupRecoveryPointClassification interface { - // GetAzureBackupRecoveryPoint returns the AzureBackupRecoveryPoint content of the underlying type. - GetAzureBackupRecoveryPoint() *AzureBackupRecoveryPoint -} - // AzureBackupRecoveryPoint - Azure backup recoveryPoint type AzureBackupRecoveryPoint struct { // REQUIRED @@ -315,16 +305,6 @@ type AzureBackupRecoveryPoint struct { // GetAzureBackupRecoveryPoint implements the AzureBackupRecoveryPointClassification interface for type AzureBackupRecoveryPoint. func (a *AzureBackupRecoveryPoint) GetAzureBackupRecoveryPoint() *AzureBackupRecoveryPoint { return a } -// AzureBackupRecoveryPointBasedRestoreRequestClassification provides polymorphic access to related types. -// Call the interface's GetAzureBackupRecoveryPointBasedRestoreRequest() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureBackupRecoveryPointBasedRestoreRequest, *AzureBackupRestoreWithRehydrationRequest -type AzureBackupRecoveryPointBasedRestoreRequestClassification interface { - AzureBackupRestoreRequestClassification - // GetAzureBackupRecoveryPointBasedRestoreRequest returns the AzureBackupRecoveryPointBasedRestoreRequest content of the underlying type. - GetAzureBackupRecoveryPointBasedRestoreRequest() *AzureBackupRecoveryPointBasedRestoreRequest -} - // AzureBackupRecoveryPointBasedRestoreRequest - Azure backup recoveryPoint based restore request type AzureBackupRecoveryPointBasedRestoreRequest struct { // REQUIRED @@ -355,11 +335,11 @@ func (a *AzureBackupRecoveryPointBasedRestoreRequest) GetAzureBackupRecoveryPoin // GetAzureBackupRestoreRequest implements the AzureBackupRestoreRequestClassification interface for type AzureBackupRecoveryPointBasedRestoreRequest. func (a *AzureBackupRecoveryPointBasedRestoreRequest) GetAzureBackupRestoreRequest() *AzureBackupRestoreRequest { return &AzureBackupRestoreRequest{ + IdentityDetails: a.IdentityDetails, ObjectType: a.ObjectType, RestoreTargetInfo: a.RestoreTargetInfo, SourceDataStoreType: a.SourceDataStoreType, SourceResourceID: a.SourceResourceID, - IdentityDetails: a.IdentityDetails, } } @@ -414,11 +394,11 @@ type AzureBackupRecoveryTimeBasedRestoreRequest struct { // GetAzureBackupRestoreRequest implements the AzureBackupRestoreRequestClassification interface for type AzureBackupRecoveryTimeBasedRestoreRequest. func (a *AzureBackupRecoveryTimeBasedRestoreRequest) GetAzureBackupRestoreRequest() *AzureBackupRestoreRequest { return &AzureBackupRestoreRequest{ + IdentityDetails: a.IdentityDetails, ObjectType: a.ObjectType, RestoreTargetInfo: a.RestoreTargetInfo, SourceDataStoreType: a.SourceDataStoreType, SourceResourceID: a.SourceResourceID, - IdentityDetails: a.IdentityDetails, } } @@ -434,16 +414,6 @@ type AzureBackupRehydrationRequest struct { RehydrationPriority *RehydrationPriority } -// AzureBackupRestoreRequestClassification provides polymorphic access to related types. -// Call the interface's GetAzureBackupRestoreRequest() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureBackupRecoveryPointBasedRestoreRequest, *AzureBackupRecoveryTimeBasedRestoreRequest, *AzureBackupRestoreRequest, -// - *AzureBackupRestoreWithRehydrationRequest -type AzureBackupRestoreRequestClassification interface { - // GetAzureBackupRestoreRequest returns the AzureBackupRestoreRequest content of the underlying type. - GetAzureBackupRestoreRequest() *AzureBackupRestoreRequest -} - // AzureBackupRestoreRequest - Azure backup restore request type AzureBackupRestoreRequest struct { // REQUIRED @@ -498,23 +468,23 @@ type AzureBackupRestoreWithRehydrationRequest struct { // interface for type AzureBackupRestoreWithRehydrationRequest. func (a *AzureBackupRestoreWithRehydrationRequest) GetAzureBackupRecoveryPointBasedRestoreRequest() *AzureBackupRecoveryPointBasedRestoreRequest { return &AzureBackupRecoveryPointBasedRestoreRequest{ - RecoveryPointID: a.RecoveryPointID, + IdentityDetails: a.IdentityDetails, ObjectType: a.ObjectType, + RecoveryPointID: a.RecoveryPointID, RestoreTargetInfo: a.RestoreTargetInfo, SourceDataStoreType: a.SourceDataStoreType, SourceResourceID: a.SourceResourceID, - IdentityDetails: a.IdentityDetails, } } // GetAzureBackupRestoreRequest implements the AzureBackupRestoreRequestClassification interface for type AzureBackupRestoreWithRehydrationRequest. func (a *AzureBackupRestoreWithRehydrationRequest) GetAzureBackupRestoreRequest() *AzureBackupRestoreRequest { return &AzureBackupRestoreRequest{ + IdentityDetails: a.IdentityDetails, ObjectType: a.ObjectType, RestoreTargetInfo: a.RestoreTargetInfo, SourceDataStoreType: a.SourceDataStoreType, SourceResourceID: a.SourceResourceID, - IdentityDetails: a.IdentityDetails, } } @@ -564,8 +534,8 @@ type AzureOperationalStoreParameters struct { // GetDataStoreParameters implements the DataStoreParametersClassification interface for type AzureOperationalStoreParameters. func (a *AzureOperationalStoreParameters) GetDataStoreParameters() *DataStoreParameters { return &DataStoreParameters{ - ObjectType: a.ObjectType, DataStoreType: a.DataStoreType, + ObjectType: a.ObjectType, } } @@ -590,15 +560,6 @@ func (a *AzureRetentionRule) GetBasePolicyRule() *BasePolicyRule { } } -// BackupCriteriaClassification provides polymorphic access to related types. -// Call the interface's GetBackupCriteria() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *BackupCriteria, *ScheduleBasedBackupCriteria -type BackupCriteriaClassification interface { - // GetBackupCriteria returns the BackupCriteria content of the underlying type. - GetBackupCriteria() *BackupCriteria -} - // BackupCriteria base class type BackupCriteria struct { // REQUIRED; Type of the specific object - used for deserializing @@ -608,15 +569,6 @@ type BackupCriteria struct { // GetBackupCriteria implements the BackupCriteriaClassification interface for type BackupCriteria. func (b *BackupCriteria) GetBackupCriteria() *BackupCriteria { return b } -// BackupDatasourceParametersClassification provides polymorphic access to related types. -// Call the interface's GetBackupDatasourceParameters() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *BackupDatasourceParameters, *BlobBackupDatasourceParameters, *KubernetesClusterBackupDatasourceParameters -type BackupDatasourceParametersClassification interface { - // GetBackupDatasourceParameters returns the BackupDatasourceParameters content of the underlying type. - GetBackupDatasourceParameters() *BackupDatasourceParameters -} - // BackupDatasourceParameters - Parameters for Backup Datasource type BackupDatasourceParameters struct { // REQUIRED; Type of the specific object - used for deserializing @@ -697,114 +649,6 @@ type BackupInstanceResourceList struct { Value []*BackupInstanceResource } -// BackupInstancesClientBeginAdhocBackupOptions contains the optional parameters for the BackupInstancesClient.BeginAdhocBackup -// method. -type BackupInstancesClientBeginAdhocBackupOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupInstancesClient.BeginCreateOrUpdate -// method. -type BackupInstancesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupInstancesClientBeginDeleteOptions contains the optional parameters for the BackupInstancesClient.BeginDelete method. -type BackupInstancesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupInstancesClientBeginResumeBackupsOptions contains the optional parameters for the BackupInstancesClient.BeginResumeBackups -// method. -type BackupInstancesClientBeginResumeBackupsOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupInstancesClientBeginResumeProtectionOptions contains the optional parameters for the BackupInstancesClient.BeginResumeProtection -// method. -type BackupInstancesClientBeginResumeProtectionOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupInstancesClientBeginStopProtectionOptions contains the optional parameters for the BackupInstancesClient.BeginStopProtection -// method. -type BackupInstancesClientBeginStopProtectionOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupInstancesClientBeginSuspendBackupsOptions contains the optional parameters for the BackupInstancesClient.BeginSuspendBackups -// method. -type BackupInstancesClientBeginSuspendBackupsOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupInstancesClientBeginSyncBackupInstanceOptions contains the optional parameters for the BackupInstancesClient.BeginSyncBackupInstance -// method. -type BackupInstancesClientBeginSyncBackupInstanceOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupInstancesClientBeginTriggerRehydrateOptions contains the optional parameters for the BackupInstancesClient.BeginTriggerRehydrate -// method. -type BackupInstancesClientBeginTriggerRehydrateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupInstancesClientBeginTriggerRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginTriggerRestore -// method. -type BackupInstancesClientBeginTriggerRestoreOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupInstancesClientBeginValidateForBackupOptions contains the optional parameters for the BackupInstancesClient.BeginValidateForBackup -// method. -type BackupInstancesClientBeginValidateForBackupOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupInstancesClientBeginValidateForRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginValidateForRestore -// method. -type BackupInstancesClientBeginValidateForRestoreOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupInstancesClientGetBackupInstanceOperationResultOptions contains the optional parameters for the BackupInstancesClient.GetBackupInstanceOperationResult -// method. -type BackupInstancesClientGetBackupInstanceOperationResultOptions struct { - // placeholder for future optional parameters -} - -// BackupInstancesClientGetOptions contains the optional parameters for the BackupInstancesClient.Get method. -type BackupInstancesClientGetOptions struct { - // placeholder for future optional parameters -} - -// BackupInstancesClientListOptions contains the optional parameters for the BackupInstancesClient.NewListPager method. -type BackupInstancesClientListOptions struct { - // placeholder for future optional parameters -} - -// BackupParametersClassification provides polymorphic access to related types. -// Call the interface's GetBackupParameters() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureBackupParams, *BackupParameters -type BackupParametersClassification interface { - // GetBackupParameters returns the BackupParameters content of the underlying type. - GetBackupParameters() *BackupParameters -} - // BackupParameters base type BackupParameters struct { // REQUIRED; Type of the specific object - used for deserializing @@ -814,27 +658,6 @@ type BackupParameters struct { // GetBackupParameters implements the BackupParametersClassification interface for type BackupParameters. func (b *BackupParameters) GetBackupParameters() *BackupParameters { return b } -// BackupPoliciesClientCreateOrUpdateOptions contains the optional parameters for the BackupPoliciesClient.CreateOrUpdate -// method. -type BackupPoliciesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// BackupPoliciesClientDeleteOptions contains the optional parameters for the BackupPoliciesClient.Delete method. -type BackupPoliciesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// BackupPoliciesClientGetOptions contains the optional parameters for the BackupPoliciesClient.Get method. -type BackupPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// BackupPoliciesClientListOptions contains the optional parameters for the BackupPoliciesClient.NewListPager method. -type BackupPoliciesClientListOptions struct { - // placeholder for future optional parameters -} - // BackupPolicy - Rule based backup policy type BackupPolicy struct { // REQUIRED; Type of datasource for the backup management @@ -894,12 +717,6 @@ type BackupVault struct { SecureScore *SecureScoreLevel } -// BackupVaultOperationResultsClientGetOptions contains the optional parameters for the BackupVaultOperationResultsClient.Get -// method. -type BackupVaultOperationResultsClientGetOptions struct { - // placeholder for future optional parameters -} - // BackupVaultResource - Backup Vault Resource type BackupVaultResource struct { // REQUIRED; BackupVaultResource properties @@ -939,57 +756,6 @@ type BackupVaultResourceList struct { Value []*BackupVaultResource } -// BackupVaultsClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupVaultsClient.BeginCreateOrUpdate -// method. -type BackupVaultsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupVaultsClientBeginDeleteOptions contains the optional parameters for the BackupVaultsClient.BeginDelete method. -type BackupVaultsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupVaultsClientBeginUpdateOptions contains the optional parameters for the BackupVaultsClient.BeginUpdate method. -type BackupVaultsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// BackupVaultsClientCheckNameAvailabilityOptions contains the optional parameters for the BackupVaultsClient.CheckNameAvailability -// method. -type BackupVaultsClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// BackupVaultsClientGetInResourceGroupOptions contains the optional parameters for the BackupVaultsClient.NewGetInResourceGroupPager -// method. -type BackupVaultsClientGetInResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// BackupVaultsClientGetInSubscriptionOptions contains the optional parameters for the BackupVaultsClient.NewGetInSubscriptionPager -// method. -type BackupVaultsClientGetInSubscriptionOptions struct { - // placeholder for future optional parameters -} - -// BackupVaultsClientGetOptions contains the optional parameters for the BackupVaultsClient.Get method. -type BackupVaultsClientGetOptions struct { - // placeholder for future optional parameters -} - -// BaseBackupPolicyClassification provides polymorphic access to related types. -// Call the interface's GetBaseBackupPolicy() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *BackupPolicy, *BaseBackupPolicy -type BaseBackupPolicyClassification interface { - // GetBaseBackupPolicy returns the BaseBackupPolicy content of the underlying type. - GetBaseBackupPolicy() *BaseBackupPolicy -} - // BaseBackupPolicy - BackupPolicy base type BaseBackupPolicy struct { // REQUIRED; Type of datasource for the backup management @@ -1029,15 +795,6 @@ type BaseBackupPolicyResourceList struct { Value []*BaseBackupPolicyResource } -// BasePolicyRuleClassification provides polymorphic access to related types. -// Call the interface's GetBasePolicyRule() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureBackupRule, *AzureRetentionRule, *BasePolicyRule -type BasePolicyRuleClassification interface { - // GetBasePolicyRule returns the BasePolicyRule content of the underlying type. - GetBasePolicyRule() *BasePolicyRule -} - // BasePolicyRule - BasePolicy Rule type BasePolicyRule struct { // REQUIRED @@ -1050,19 +807,10 @@ type BasePolicyRule struct { // GetBasePolicyRule implements the BasePolicyRuleClassification interface for type BasePolicyRule. func (b *BasePolicyRule) GetBasePolicyRule() *BasePolicyRule { return b } -// BaseResourcePropertiesClassification provides polymorphic access to related types. -// Call the interface's GetBaseResourceProperties() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *BaseResourceProperties -type BaseResourcePropertiesClassification interface { - // GetBaseResourceProperties returns the BaseResourceProperties content of the underlying type. - GetBaseResourceProperties() *BaseResourceProperties -} - // BaseResourceProperties - Properties which are specific to datasource/datasourceSets type BaseResourceProperties struct { // REQUIRED; Type of the specific object - used for deserializing - ObjectType *string + ObjectType *ResourcePropertiesObjectType } // GetBaseResourceProperties implements the BaseResourcePropertiesClassification interface for type BaseResourceProperties. @@ -1105,11 +853,6 @@ type CheckNameAvailabilityResult struct { Reason *string } -// ClientCheckFeatureSupportOptions contains the optional parameters for the Client.CheckFeatureSupport method. -type ClientCheckFeatureSupportOptions struct { - // placeholder for future optional parameters -} - // ClientDiscoveryDisplay - Localized display information of an operation. type ClientDiscoveryDisplay struct { // Description of the operation having details of what operation is about. @@ -1189,15 +932,6 @@ func (c *CopyOnExpiryOption) GetCopyOption() *CopyOption { } } -// CopyOptionClassification provides polymorphic access to related types. -// Call the interface's GetCopyOption() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *CopyOnExpiryOption, *CopyOption, *CustomCopyOption, *ImmediateCopyOption -type CopyOptionClassification interface { - // GetCopyOption returns the CopyOption content of the underlying type. - GetCopyOption() *CopyOption -} - // CopyOption - Options to copy type CopyOption struct { // REQUIRED; Type of the specific object - used for deserializing @@ -1207,6 +941,43 @@ type CopyOption struct { // GetCopyOption implements the CopyOptionClassification interface for type CopyOption. func (c *CopyOption) GetCopyOption() *CopyOption { return c } +// CrossRegionRestoreDetails - Cross Region Restore details +type CrossRegionRestoreDetails struct { + // REQUIRED + SourceBackupInstanceID *string + + // REQUIRED + SourceRegion *string +} + +type CrossRegionRestoreJobRequest struct { + // REQUIRED + JobID *string + + // REQUIRED + SourceBackupVaultID *string + + // REQUIRED + SourceRegion *string +} + +type CrossRegionRestoreJobsRequest struct { + // REQUIRED + SourceBackupVaultID *string + + // REQUIRED + SourceRegion *string +} + +// CrossRegionRestoreRequestObject - Cross Region Restore Request Object +type CrossRegionRestoreRequestObject struct { + // REQUIRED; Cross region restore details. + CrossRegionRestoreDetails *CrossRegionRestoreDetails + + // REQUIRED; Gets or sets the restore request object. + RestoreRequestObject AzureBackupRestoreRequestClassification +} + type CrossRegionRestoreSettings struct { // CrossRegionRestore state State *CrossRegionRestoreState @@ -1243,15 +1014,6 @@ type DataStoreInfoBase struct { ObjectType *string } -// DataStoreParametersClassification provides polymorphic access to related types. -// Call the interface's GetDataStoreParameters() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureOperationalStoreParameters, *DataStoreParameters -type DataStoreParametersClassification interface { - // GetDataStoreParameters returns the DataStoreParameters content of the underlying type. - GetDataStoreParameters() *DataStoreParameters -} - // DataStoreParameters - Parameters for DataStore type DataStoreParameters struct { // REQUIRED; type of datastore; Operational/Vault/Archive @@ -1329,13 +1091,17 @@ type Day struct { IsLast *bool } -// DeleteOptionClassification provides polymorphic access to related types. -// Call the interface's GetDeleteOption() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AbsoluteDeleteOption, *DeleteOption -type DeleteOptionClassification interface { - // GetDeleteOption returns the DeleteOption content of the underlying type. - GetDeleteOption() *DeleteOption +// DefaultResourceProperties - Default source properties +type DefaultResourceProperties struct { + // REQUIRED; Type of the specific object - used for deserializing + ObjectType *ResourcePropertiesObjectType +} + +// GetBaseResourceProperties implements the BaseResourcePropertiesClassification interface for type DefaultResourceProperties. +func (d *DefaultResourceProperties) GetBaseResourceProperties() *BaseResourceProperties { + return &BaseResourceProperties{ + ObjectType: d.ObjectType, + } } // DeleteOption - Delete Option @@ -1419,24 +1185,6 @@ type DeletedBackupInstanceResourceList struct { Value []*DeletedBackupInstanceResource } -// 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.NewListPager -// method. -type DeletedBackupInstancesClientListOptions struct { - // placeholder for future optional parameters -} - // DeletionInfo - Deletion Info type DeletionInfo struct { // READ-ONLY; Specifies billing end date @@ -1544,34 +1292,6 @@ type DppResource struct { Type *string } -// DppResourceGuardProxyClientCreateOrUpdateOptions contains the optional parameters for the DppResourceGuardProxyClient.CreateOrUpdate -// method. -type DppResourceGuardProxyClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// DppResourceGuardProxyClientDeleteOptions contains the optional parameters for the DppResourceGuardProxyClient.Delete method. -type DppResourceGuardProxyClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// DppResourceGuardProxyClientGetOptions contains the optional parameters for the DppResourceGuardProxyClient.Get method. -type DppResourceGuardProxyClientGetOptions struct { - // placeholder for future optional parameters -} - -// DppResourceGuardProxyClientListOptions contains the optional parameters for the DppResourceGuardProxyClient.NewListPager -// method. -type DppResourceGuardProxyClientListOptions struct { - // placeholder for future optional parameters -} - -// DppResourceGuardProxyClientUnlockDeleteOptions contains the optional parameters for the DppResourceGuardProxyClient.UnlockDelete -// method. -type DppResourceGuardProxyClientUnlockDeleteOptions struct { - // placeholder for future optional parameters -} - // DppResourceList - ListResource type DppResourceList struct { // The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. @@ -1650,18 +1370,6 @@ type ErrorAdditionalInfo struct { Type *string } -// ExportJobsClientBeginTriggerOptions contains the optional parameters for the ExportJobsClient.BeginTrigger method. -type ExportJobsClientBeginTriggerOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ExportJobsOperationResultClientGetOptions contains the optional parameters for the ExportJobsOperationResultClient.Get -// method. -type ExportJobsOperationResultClientGetOptions struct { - // placeholder for future optional parameters -} - // ExportJobsResult - The result for export jobs containing blob details. type ExportJobsResult struct { // READ-ONLY; SAS key to access the blob. @@ -1704,15 +1412,6 @@ func (f *FeatureValidationRequest) GetFeatureValidationRequestBase() *FeatureVal } } -// FeatureValidationRequestBaseClassification provides polymorphic access to related types. -// Call the interface's GetFeatureValidationRequestBase() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *FeatureValidationRequest, *FeatureValidationRequestBase -type FeatureValidationRequestBaseClassification interface { - // GetFeatureValidationRequestBase returns the FeatureValidationRequestBase content of the underlying type. - GetFeatureValidationRequestBase() *FeatureValidationRequestBase -} - // FeatureValidationRequestBase - Base class for Backup Feature support type FeatureValidationRequestBase struct { // REQUIRED; Type of the specific object - used for deserializing @@ -1743,15 +1442,6 @@ func (f *FeatureValidationResponse) GetFeatureValidationResponseBase() *FeatureV } } -// FeatureValidationResponseBaseClassification provides polymorphic access to related types. -// Call the interface's GetFeatureValidationResponseBase() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *FeatureValidationResponse, *FeatureValidationResponseBase -type FeatureValidationResponseBaseClassification interface { - // GetFeatureValidationResponseBase returns the FeatureValidationResponseBase content of the underlying type. - GetFeatureValidationResponseBase() *FeatureValidationResponseBase -} - // FeatureValidationResponseBase - Base class for Backup Feature support type FeatureValidationResponseBase struct { // REQUIRED; Type of the specific object - used for deserializing @@ -1763,6 +1453,16 @@ func (f *FeatureValidationResponseBase) GetFeatureValidationResponseBase() *Feat return f } +// FetchSecondaryRPsRequestParameters - Information about BI whose secondary RecoveryPoints are requested Source region and +// BI ARM path +type FetchSecondaryRPsRequestParameters struct { + // ARM Path of BackupInstance + SourceBackupInstanceID *string + + // Source region in which BackupInstance is located + SourceRegion *string +} + type IdentityDetails struct { // Specifies if the BI is protected by System Identity. UseSystemAssignedIdentity *bool @@ -1802,16 +1502,6 @@ type InnerError struct { EmbeddedInnerError *InnerError } -// ItemLevelRestoreCriteriaClassification provides polymorphic access to related types. -// Call the interface's GetItemLevelRestoreCriteria() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *ItemLevelRestoreCriteria, *ItemPathBasedRestoreCriteria, *KubernetesClusterRestoreCriteria, *KubernetesPVRestoreCriteria, -// - *KubernetesStorageClassRestoreCriteria, *RangeBasedItemLevelRestoreCriteria -type ItemLevelRestoreCriteriaClassification interface { - // GetItemLevelRestoreCriteria returns the ItemLevelRestoreCriteria content of the underlying type. - GetItemLevelRestoreCriteria() *ItemLevelRestoreCriteria -} - // ItemLevelRestoreCriteria - Class to contain criteria for item level restore type ItemLevelRestoreCriteria struct { // REQUIRED; Type of the specific object - used for deserializing @@ -1899,6 +1589,9 @@ type JobExtendedInfo struct { // READ-ONLY; Details of the Target Recovery Point TargetRecoverPoint *RestoreJobRecoveryPointDetails + + // READ-ONLY; A List, detailing the warnings related to the job + WarningDetails []*UserFacingWarningDetail } // JobSubTask - Details of Job's Sub Task @@ -1919,16 +1612,6 @@ type JobSubTask struct { TaskProgress *string } -// JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. -type JobsClientGetOptions struct { - // placeholder for future optional parameters -} - -// JobsClientListOptions contains the optional parameters for the JobsClient.NewListPager method. -type JobsClientListOptions struct { - // placeholder for future optional parameters -} - // KubernetesClusterBackupDatasourceParameters - Parameters for Kubernetes Cluster Backup Datasource type KubernetesClusterBackupDatasourceParameters struct { // REQUIRED; Gets or sets the include cluster resources property. This property if enabled will include cluster scope resources @@ -2004,6 +1687,12 @@ type KubernetesClusterRestoreCriteria struct { // Gets or sets the restore hook references. This property sets the hook reference to be executed during restore. RestoreHookReferences []*NamespacedNameResource + + // Gets or sets the staging RG Id for creating staging disks and snapshots during restore. + StagingResourceGroupID *string + + // Gets or sets the staging Storage Account Id for creating backup object store data during restore. + StagingStorageAccountID *string } // GetItemLevelRestoreCriteria implements the ItemLevelRestoreCriteriaClassification interface for type KubernetesClusterRestoreCriteria. @@ -2066,15 +1755,6 @@ type NamespacedNameResource struct { Namespace *string } -// OperationExtendedInfoClassification provides polymorphic access to related types. -// Call the interface's GetOperationExtendedInfo() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *OperationExtendedInfo, *OperationJobExtendedInfo -type OperationExtendedInfoClassification interface { - // GetOperationExtendedInfo returns the OperationExtendedInfo content of the underlying type. - GetOperationExtendedInfo() *OperationExtendedInfo -} - // OperationExtendedInfo - Operation Extended Info type OperationExtendedInfo struct { // REQUIRED; This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types. @@ -2124,33 +1804,6 @@ type OperationResource struct { Status *string } -// OperationResultClientGetOptions contains the optional parameters for the OperationResultClient.Get method. -type OperationResultClientGetOptions struct { - // placeholder for future optional parameters -} - -// OperationStatusBackupVaultContextClientGetOptions contains the optional parameters for the OperationStatusBackupVaultContextClient.Get -// method. -type OperationStatusBackupVaultContextClientGetOptions struct { - // placeholder for future optional parameters -} - -// OperationStatusClientGetOptions contains the optional parameters for the OperationStatusClient.Get method. -type OperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} - -// OperationStatusResourceGroupContextClientGetOptions contains the optional parameters for the OperationStatusResourceGroupContextClient.Get -// method. -type OperationStatusResourceGroupContextClientGetOptions struct { - // placeholder for future optional parameters -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // PatchBackupVaultInput - Backup Vault Contract for Patch Backup Vault API. type PatchBackupVaultInput struct { // Feature Settings @@ -2247,19 +1900,6 @@ type RecoveryPointDataStoreDetails struct { RehydrationStatus *RehydrationStatus } -// RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. -type RecoveryPointsClientGetOptions struct { - // placeholder for future optional parameters -} - -// RecoveryPointsClientListOptions contains the optional parameters for the RecoveryPointsClient.NewListPager method. -type RecoveryPointsClientListOptions struct { - // OData filter options. - Filter *string - // skipToken Filter. - SkipToken *string -} - type RecoveryPointsFilters struct { EndDate *string ExtendedInfo *bool @@ -2371,110 +2011,6 @@ type ResourceGuardResourceList struct { Value []*ResourceGuardResource } -// ResourceGuardsClientDeleteOptions contains the optional parameters for the ResourceGuardsClient.Delete method. -type ResourceGuardsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientGetBackupSecurityPINRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetBackupSecurityPINRequestsObjectsPager -// method. -type ResourceGuardsClientGetBackupSecurityPINRequestsObjectsOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectOptions contains the optional parameters for the ResourceGuardsClient.GetDefaultBackupSecurityPINRequestsObject -// method. -type ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectOptions contains the optional parameters for the ResourceGuardsClient.GetDefaultDeleteProtectedItemRequestsObject -// method. -type ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectOptions contains the optional parameters for the ResourceGuardsClient.GetDefaultDeleteResourceGuardProxyRequestsObject -// method. -type ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectOptions contains the optional parameters for the ResourceGuardsClient.GetDefaultDisableSoftDeleteRequestsObject -// method. -type ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectOptions contains the optional parameters for the ResourceGuardsClient.GetDefaultUpdateProtectedItemRequestsObject -// method. -type ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectOptions contains the optional parameters for the ResourceGuardsClient.GetDefaultUpdateProtectionPolicyRequestsObject -// method. -type ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetDeleteProtectedItemRequestsObjectsPager -// method. -type ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetDeleteResourceGuardProxyRequestsObjectsPager -// method. -type ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetDisableSoftDeleteRequestsObjectsPager -// method. -type ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientGetOptions contains the optional parameters for the ResourceGuardsClient.Get method. -type ResourceGuardsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientGetResourcesInResourceGroupOptions contains the optional parameters for the ResourceGuardsClient.NewGetResourcesInResourceGroupPager -// method. -type ResourceGuardsClientGetResourcesInResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientGetResourcesInSubscriptionOptions contains the optional parameters for the ResourceGuardsClient.NewGetResourcesInSubscriptionPager -// method. -type ResourceGuardsClientGetResourcesInSubscriptionOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetUpdateProtectedItemRequestsObjectsPager -// method. -type ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetUpdateProtectionPolicyRequestsObjectsPager -// method. -type ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientPatchOptions contains the optional parameters for the ResourceGuardsClient.Patch method. -type ResourceGuardsClientPatchOptions struct { - // placeholder for future optional parameters -} - -// ResourceGuardsClientPutOptions contains the optional parameters for the ResourceGuardsClient.Put method. -type ResourceGuardsClientPutOptions struct { - // placeholder for future optional parameters -} - // ResourceMoveDetails will be returned in response to GetResource call from ARM type ResourceMoveDetails struct { // Completion time in UTC of latest ResourceMove operation attempted. ISO 8601 format. @@ -2502,11 +2038,6 @@ type RestorableTimeRange struct { ObjectType *string } -// RestorableTimeRangesClientFindOptions contains the optional parameters for the RestorableTimeRangesClient.Find method. -type RestorableTimeRangesClientFindOptions struct { - // placeholder for future optional parameters -} - // RestoreFilesTargetInfo - Class encapsulating restore as files target parameters type RestoreFilesTargetInfo struct { // REQUIRED; Type of Datasource object, used to initialize the right inherited type @@ -2566,15 +2097,6 @@ func (r *RestoreTargetInfo) GetRestoreTargetInfoBase() *RestoreTargetInfoBase { } } -// RestoreTargetInfoBaseClassification provides polymorphic access to related types. -// Call the interface's GetRestoreTargetInfoBase() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *ItemLevelRestoreTargetInfo, *RestoreFilesTargetInfo, *RestoreTargetInfo, *RestoreTargetInfoBase -type RestoreTargetInfoBaseClassification interface { - // GetRestoreTargetInfoBase returns the RestoreTargetInfoBase content of the underlying type. - GetRestoreTargetInfoBase() *RestoreTargetInfoBase -} - // RestoreTargetInfoBase - Base class common to RestoreTargetInfo and RestoreFilesTargetInfo type RestoreTargetInfoBase struct { // REQUIRED; Type of Datasource object, used to initialize the right inherited type @@ -2805,15 +2327,6 @@ type TriggerBackupRequest struct { BackupRuleOptions *AdHocBackupRuleOptions } -// TriggerContextClassification provides polymorphic access to related types. -// Call the interface's GetTriggerContext() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AdhocBasedTriggerContext, *ScheduleBasedTriggerContext, *TriggerContext -type TriggerContextClassification interface { - // GetTriggerContext returns the TriggerContext content of the underlying type. - GetTriggerContext() *TriggerContext -} - // TriggerContext - Trigger context type TriggerContext struct { // REQUIRED; Type of the specific object - used for deserializing @@ -2844,6 +2357,15 @@ type UserAssignedIdentity struct { PrincipalID *string } +// UserAssignedIdentityDetails - User Assigned Identity Details +type UserAssignedIdentityDetails struct { + // READ-ONLY; The Client Id of the User Assigned Managed Identity. + ClientID *string + + // READ-ONLY; The Object Id of the User Assigned Managed Identity. + PrincipalID *string +} + // UserFacingError - Error object used by layers that have access to localized content, and propagate that to user type UserFacingError struct { // Unique code for this error @@ -2872,6 +2394,24 @@ type UserFacingError struct { Target *string } +// UserFacingWarningDetail - Warning object used by layers that have access to localized content, and propagate that to user +type UserFacingWarningDetail struct { + // REQUIRED; Error details for the warning. + Warning *UserFacingError + + // Name of resource for which warning is raised. + ResourceName *string +} + +// ValidateCrossRegionRestoreRequestObject - Cross Region Restore Request Object +type ValidateCrossRegionRestoreRequestObject struct { + // REQUIRED; Cross region restore details. + CrossRegionRestoreDetails *CrossRegionRestoreDetails + + // REQUIRED; Gets or sets the restore request object. + RestoreRequestObject AzureBackupRestoreRequestClassification +} + // ValidateForBackupRequest - Validate for backup request type ValidateForBackupRequest struct { // REQUIRED; Backup Instance diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/models_serde.go b/sdk/resourcemanager/dataprotection/armdataprotection/models_serde.go index 5d7ded859860..41e9d9a287a9 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/models_serde.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/models_serde.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -449,6 +448,7 @@ func (a AzureBackupJob) MarshalJSON() ([]byte, error) { populate(objectMap, "rehydrationPriority", a.RehydrationPriority) populate(objectMap, "restoreType", a.RestoreType) populate(objectMap, "sourceDataStoreName", a.SourceDataStoreName) + populate(objectMap, "sourceDataStoreType", a.SourceDataStoreType) populate(objectMap, "sourceResourceGroup", a.SourceResourceGroup) populate(objectMap, "sourceSubscriptionID", a.SourceSubscriptionID) populateTimeRFC3339(objectMap, "startTime", a.StartTime) @@ -540,6 +540,9 @@ func (a *AzureBackupJob) UnmarshalJSON(data []byte) error { case "sourceDataStoreName": err = unpopulate(val, "SourceDataStoreName", &a.SourceDataStoreName) delete(rawMsg, key) + case "sourceDataStoreType": + err = unpopulate(val, "SourceDataStoreType", &a.SourceDataStoreType) + delete(rawMsg, key) case "sourceResourceGroup": err = unpopulate(val, "SourceResourceGroup", &a.SourceResourceGroup) delete(rawMsg, key) @@ -569,6 +572,33 @@ func (a *AzureBackupJob) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AzureBackupJobProgressURL. +func (a AzureBackupJobProgressURL) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "progressUrl", a.ProgressURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureBackupJobProgressURL. +func (a *AzureBackupJobProgressURL) 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 "progressUrl": + err = unpopulate(val, "ProgressURL", &a.ProgressURL) + 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]any) @@ -2107,6 +2137,134 @@ func (c *CopyOption) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CrossRegionRestoreDetails. +func (c CrossRegionRestoreDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sourceBackupInstanceId", c.SourceBackupInstanceID) + populate(objectMap, "sourceRegion", c.SourceRegion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CrossRegionRestoreDetails. +func (c *CrossRegionRestoreDetails) 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 "sourceBackupInstanceId": + err = unpopulate(val, "SourceBackupInstanceID", &c.SourceBackupInstanceID) + delete(rawMsg, key) + case "sourceRegion": + err = unpopulate(val, "SourceRegion", &c.SourceRegion) + 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 CrossRegionRestoreJobRequest. +func (c CrossRegionRestoreJobRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "jobId", c.JobID) + populate(objectMap, "sourceBackupVaultId", c.SourceBackupVaultID) + populate(objectMap, "sourceRegion", c.SourceRegion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CrossRegionRestoreJobRequest. +func (c *CrossRegionRestoreJobRequest) 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 "jobId": + err = unpopulate(val, "JobID", &c.JobID) + delete(rawMsg, key) + case "sourceBackupVaultId": + err = unpopulate(val, "SourceBackupVaultID", &c.SourceBackupVaultID) + delete(rawMsg, key) + case "sourceRegion": + err = unpopulate(val, "SourceRegion", &c.SourceRegion) + 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 CrossRegionRestoreJobsRequest. +func (c CrossRegionRestoreJobsRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sourceBackupVaultId", c.SourceBackupVaultID) + populate(objectMap, "sourceRegion", c.SourceRegion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CrossRegionRestoreJobsRequest. +func (c *CrossRegionRestoreJobsRequest) 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 "sourceBackupVaultId": + err = unpopulate(val, "SourceBackupVaultID", &c.SourceBackupVaultID) + delete(rawMsg, key) + case "sourceRegion": + err = unpopulate(val, "SourceRegion", &c.SourceRegion) + 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 CrossRegionRestoreRequestObject. +func (c CrossRegionRestoreRequestObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "crossRegionRestoreDetails", c.CrossRegionRestoreDetails) + populate(objectMap, "restoreRequestObject", c.RestoreRequestObject) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CrossRegionRestoreRequestObject. +func (c *CrossRegionRestoreRequestObject) 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 "crossRegionRestoreDetails": + err = unpopulate(val, "CrossRegionRestoreDetails", &c.CrossRegionRestoreDetails) + delete(rawMsg, key) + case "restoreRequestObject": + c.RestoreRequestObject, err = unmarshalAzureBackupRestoreRequestClassification(val) + 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 CrossRegionRestoreSettings. func (c CrossRegionRestoreSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2395,6 +2553,33 @@ func (d *Day) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DefaultResourceProperties. +func (d DefaultResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["objectType"] = ResourcePropertiesObjectTypeDefaultResourceProperties + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultResourceProperties. +func (d *DefaultResourceProperties) 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 "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 DeleteOption. func (d DeleteOption) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3280,6 +3465,37 @@ func (f *FeatureValidationResponseBase) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type FetchSecondaryRPsRequestParameters. +func (f FetchSecondaryRPsRequestParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "sourceBackupInstanceId", f.SourceBackupInstanceID) + populate(objectMap, "sourceRegion", f.SourceRegion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FetchSecondaryRPsRequestParameters. +func (f *FetchSecondaryRPsRequestParameters) 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 "sourceBackupInstanceId": + err = unpopulate(val, "SourceBackupInstanceID", &f.SourceBackupInstanceID) + delete(rawMsg, key) + case "sourceRegion": + err = unpopulate(val, "SourceRegion", &f.SourceRegion) + 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 IdentityDetails. func (i IdentityDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3527,6 +3743,7 @@ func (j JobExtendedInfo) MarshalJSON() ([]byte, error) { populate(objectMap, "sourceRecoverPoint", j.SourceRecoverPoint) populate(objectMap, "subTasks", j.SubTasks) populate(objectMap, "targetRecoverPoint", j.TargetRecoverPoint) + populate(objectMap, "warningDetails", j.WarningDetails) return json.Marshal(objectMap) } @@ -3560,6 +3777,9 @@ func (j *JobExtendedInfo) UnmarshalJSON(data []byte) error { case "targetRecoverPoint": err = unpopulate(val, "TargetRecoverPoint", &j.TargetRecoverPoint) delete(rawMsg, key) + case "warningDetails": + err = unpopulate(val, "WarningDetails", &j.WarningDetails) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", j, err) @@ -3684,6 +3904,8 @@ func (k KubernetesClusterRestoreCriteria) MarshalJSON() ([]byte, error) { objectMap["objectType"] = "KubernetesClusterRestoreCriteria" populate(objectMap, "persistentVolumeRestoreMode", k.PersistentVolumeRestoreMode) populate(objectMap, "restoreHookReferences", k.RestoreHookReferences) + populate(objectMap, "stagingResourceGroupId", k.StagingResourceGroupID) + populate(objectMap, "stagingStorageAccountId", k.StagingStorageAccountID) return json.Marshal(objectMap) } @@ -3729,6 +3951,12 @@ func (k *KubernetesClusterRestoreCriteria) UnmarshalJSON(data []byte) error { case "restoreHookReferences": err = unpopulate(val, "RestoreHookReferences", &k.RestoreHookReferences) delete(rawMsg, key) + case "stagingResourceGroupId": + err = unpopulate(val, "StagingResourceGroupID", &k.StagingResourceGroupID) + delete(rawMsg, key) + case "stagingStorageAccountId": + err = unpopulate(val, "StagingStorageAccountID", &k.StagingStorageAccountID) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", k, err) @@ -5527,6 +5755,37 @@ func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentityDetails. +func (u UserAssignedIdentityDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentityDetails. +func (u *UserAssignedIdentityDetails) 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 "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type UserFacingError. func (u UserFacingError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5586,6 +5845,68 @@ func (u *UserFacingError) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type UserFacingWarningDetail. +func (u UserFacingWarningDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceName", u.ResourceName) + populate(objectMap, "warning", u.Warning) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserFacingWarningDetail. +func (u *UserFacingWarningDetail) 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 "resourceName": + err = unpopulate(val, "ResourceName", &u.ResourceName) + delete(rawMsg, key) + case "warning": + err = unpopulate(val, "Warning", &u.Warning) + 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 ValidateCrossRegionRestoreRequestObject. +func (v ValidateCrossRegionRestoreRequestObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "crossRegionRestoreDetails", v.CrossRegionRestoreDetails) + populate(objectMap, "restoreRequestObject", v.RestoreRequestObject) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidateCrossRegionRestoreRequestObject. +func (v *ValidateCrossRegionRestoreRequestObject) 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 "crossRegionRestoreDetails": + err = unpopulate(val, "CrossRegionRestoreDetails", &v.CrossRegionRestoreDetails) + delete(rawMsg, 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 +} + // MarshalJSON implements the json.Marshaller interface for type ValidateForBackupRequest. func (v ValidateForBackupRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client.go index 9ffe5783e26b..244f66f69fea 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -48,21 +47,24 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.getCreateRequest(ctx, operationID, location, options) if err != nil { return OperationResultClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationResultClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return OperationResultClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return OperationResultClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -82,7 +84,7 @@ func (client *OperationResultClient) getCreateRequest(ctx context.Context, opera return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -91,12 +93,12 @@ func (client *OperationResultClient) getCreateRequest(ctx context.Context, opera // getHandleResponse handles the Get response. func (client *OperationResultClient) getHandleResponse(resp *http.Response) (OperationResultClientGetResponse, error) { result := OperationResultClientGetResponse{} - if val := resp.Header.Get("Location"); val != "" { - result.Location = &val - } if val := resp.Header.Get("Azure-AsyncOperation"); val != "" { result.AzureAsyncOperation = &val } + if val := resp.Header.Get("Location"); val != "" { + result.Location = &val + } if val := resp.Header.Get("Retry-After"); val != "" { retryAfter32, err := strconv.ParseInt(val, 10, 32) retryAfter := int32(retryAfter32) diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client_example_test.go deleted file mode 100644 index db14d242e2f1..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client_example_test.go +++ /dev/null @@ -1,42 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationResultClient().Get(ctx, "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA==", "WestUS", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationJobExtendedInfo = armdataprotection.OperationJobExtendedInfo{ - // ObjectType: to.Ptr("OperationJobExtendedInfo"), - // JobID: to.Ptr("c60cb49-63e8-4b21-b9bd-26277b3fdfae"), - // } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operations_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/operations_client.go index ad22a3a579c4..cf0c1982a4a4 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operations_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/operations_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Returns the list of available operations. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -78,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operations_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/operations_client_example_test.go deleted file mode 100644 index 3bbf7ecbfd92..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operations_client_example_test.go +++ /dev/null @@ -1,566 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-01/examples/Operations/List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ClientDiscoveryResponse = armdataprotection.ClientDiscoveryResponse{ - // Value: []*armdataprotection.ClientDiscoveryValueForSingleAPI{ - // { - // Name: to.Ptr("Microsoft.DataProtection/locations/getBackupStatus/action"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Check Backup Status for Recovery Services Vaults"), - // Operation: to.Ptr("Check Backup Status for Vault"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Status"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/write"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Creates a Backup Instance"), - // Operation: to.Ptr("Create a Backup Instance"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Instance"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/delete"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Deletes the Backup Instance"), - // Operation: to.Ptr("Delete Backup Instance"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Instance"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns details of the Backup Instance"), - // Operation: to.Ptr("Get Backup Instance Details"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Instance"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns all Backup Instances"), - // Operation: to.Ptr("Get Backup Instances"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Instance"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/backup/action"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Performs Backup on the Backup Instance"), - // Operation: to.Ptr("Backup Backup Instance"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Instance"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/sync/action"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Sync operation retries last failed operation on backup instance to bring it to a valid state."), - // Operation: to.Ptr("Sync Backup Instance"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Instance"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/operationResults/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns Backup Operation Result for Backup Vault."), - // Operation: to.Ptr("Get Backup Operation Result"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Instance"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/stopProtection/action"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Stop Protection operation stops both backup and retention schedules of backup instance. Existing data will be retained forever."), - // Operation: to.Ptr("Stop Protection of Backup Instance"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Instance"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/suspendBackups/action"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Suspend Backups operation stops only backups of backup instance. Retention activities will continue and hence data will be ratained as per policy."), - // Operation: to.Ptr("Suspend Backups of Backup Instance"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Instance"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/resumeProtection/action"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Resume protection of a ProtectionStopped BI."), - // Operation: to.Ptr("Resume Protection of Backup Instance"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Instance"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/resumeBackups/action"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Resume Backups for a BackupsSuspended BI."), - // Operation: to.Ptr("Resume Backups of Backup Instance"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Instance"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/validateRestore/action"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Validates for Restore of the Backup Instance"), - // Operation: to.Ptr("Validate for Restore of Backup Instance"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Instance"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/restore/action"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Triggers restore on the Backup Instance"), - // Operation: to.Ptr("Restore Backup Instance"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Instance"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupPolicies/write"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Creates Backup Policy"), - // Operation: to.Ptr("Create Backup Policy"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Policies"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupPolicies/delete"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Deletes the Backup Policy"), - // Operation: to.Ptr("Delete Backup Policy"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Policies"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupPolicies/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns details of the Backup Policy"), - // Operation: to.Ptr("Get Backup Policy details"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Policies"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupPolicies/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns all Backup Policies"), - // Operation: to.Ptr("Get Backup Policies"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Policies"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupResourceGuardProxies/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Get the list of ResourceGuard proxies for a resource"), - // Operation: to.Ptr("Get the list of ResourceGuard proxies for a resource"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Guard Proxy"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupResourceGuardProxies/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Get ResourceGuard proxy operation gets an object representing the Azure resource of type 'ResourceGuard proxy'"), - // Operation: to.Ptr("Get ResourceGuard proxy"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Guard Proxy"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupResourceGuardProxies/write"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Create ResourceGuard proxy operation creates an Azure resource of type 'ResourceGuard Proxy'"), - // Operation: to.Ptr("Create ResourceGuard proxy"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Guard Proxy"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupResourceGuardProxies/delete"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("The Delete ResourceGuard proxy operation deletes the specified Azure resource of type 'ResourceGuard proxy'"), - // Operation: to.Ptr("Delete ResourceGuard proxy"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Guard Proxy"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupResourceGuardProxies/unlockDelete/action"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Unlock delete ResourceGuard proxy operation unlocks the next delete critical operation"), - // Operation: to.Ptr("Unlock delete ResourceGuard proxy operation unlocks the next delete critical operation"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Guard Proxy"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/recoveryPoints/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns details of the Recovery Point"), - // Operation: to.Ptr("Get Recovery Point Details"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Recovery Points"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/recoveryPoints/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns all Recovery Points"), - // Operation: to.Ptr("Get Recovery Points"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Recovery Points"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/findRestorableTimeRanges/action"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Finds Restorable Time Ranges"), - // Operation: to.Ptr("Find Restorable Time Ranges"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Restorable Time Ranges"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/write"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Create BackupVault operation creates an Azure resource of type 'Backup Vault'"), - // Operation: to.Ptr("Create Backup Vault"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Vaults"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Create BackupVault operation creates an Azure resource of type 'Backup Vault'"), - // Operation: to.Ptr("Create Backup Vault"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Vaults"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/delete"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Create BackupVault operation creates an Azure resource of type 'Backup Vault'"), - // Operation: to.Ptr("Create Backup Vault"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Vaults"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/operationResults/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Gets Operation Result of a Patch Operation for a Backup Vault"), - // Operation: to.Ptr("Get Operation Result of a Patch Operation for a Backup Vault"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Vaults"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/locations/checkNameAvailability/action"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Checks if the requested BackupVault Name is Available"), - // Operation: to.Ptr("Check if the requested BackupVault Name is Available"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Vaults"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Gets list of Backup Vaults in a Resource Group"), - // Operation: to.Ptr("Get Backup Vaults in a Resource Group"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Vaults"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Gets list of Backup Vaults in a Subscription"), - // Operation: to.Ptr("Get Backup Vaults in a Subscription"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Vaults"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/subscriptions/resourceGroups/providers/resourceGuards/write"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Create ResourceGuard operation creates an Azure resource of type 'ResourceGuard'"), - // Operation: to.Ptr("Create ResourceGuard"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Guards"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/subscriptions/resourceGroups/providers/resourceGuards/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("The Get ResourceGuard operation gets an object representing the Azure resource of type 'ResourceGuard'"), - // Operation: to.Ptr("Get ResourceGuard"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Guards"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/subscriptions/resourceGroups/providers/resourceGuards/delete"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("The Delete ResourceGuard operation deletes the specified Azure resource of type 'ResourceGuard'"), - // Operation: to.Ptr("Delete ResourceGuard"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Guards"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/subscriptions/resourceGroups/providers/resourceGuards/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Gets list of ResourceGuards in a Resource Group"), - // Operation: to.Ptr("Get ResourceGuards in a Resource Group"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Guards"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/subscriptions/providers/resourceGuards/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Gets list of ResourceGuards in a Subscription"), - // Operation: to.Ptr("Get ResourceGuards in a Subscription"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Guards"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/subscriptions/resourceGroups/providers/resourceGuards/write"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Update ResouceGuard operation updates an Azure resource of type 'ResourceGuard'"), - // Operation: to.Ptr("Update ResourceGuard"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Guards"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/subscriptions/resourceGroups/providers/resourceGuards/{operationName}/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Gets ResourceGuard operation request info"), - // Operation: to.Ptr("Get ResourceGuard operation request info"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Guards"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/subscriptions/resourceGroups/providers/resourceGuards/{operationName}/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Gets ResourceGuard default operation request info"), - // Operation: to.Ptr("Get ResourceGuard default operation request info"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Guards"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/subscriptions/providers/locations/checkFeatureSupport/action"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Validates if a feature is supported"), - // Operation: to.Ptr("Validate if a feature is supported"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Provider Operation"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/locations/operationStatus/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns Backup Operation Status for Backup Vault."), - // Operation: to.Ptr("Get Backup Operation Status"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Operation Status"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/operationStatus/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns Backup Operation Status for Backup Vault."), - // Operation: to.Ptr("Get Backup Operation Status"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Operation Status"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/subscriptions/resourceGroups/providers/operationStatus/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns Backup Operation Status for Backup Vault."), - // Operation: to.Ptr("Get Backup Operation Status"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Operation Status"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/locations/operationResults/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Returns Backup Operation Result for Backup Vault."), - // Operation: to.Ptr("Get Backup Operation Result"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Operation Results"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/validateForBackup/action"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Validates for backup of Backup Instance"), - // Operation: to.Ptr("Validate for backup of Backup Instance"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Validate Backup"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/backupVaults/backupJobs/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Get Jobs list"), - // Operation: to.Ptr("Backup Jobs"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Jobs"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.RecoveryServices/Vaults/backupJobs/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Get Job details"), - // Operation: to.Ptr("Backup Job Object"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Backup Jobs"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/register/action"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Registers subscription for given Resource Provider"), - // Operation: to.Ptr("Register Resource Provider"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Provider Operation"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/unregister/action"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Unregisters subscription for given Resource Provider"), - // Operation: to.Ptr("Unregister Resource Provider"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Provider Operation"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.DataProtection/operations/read"), - // Display: &armdataprotection.ClientDiscoveryDisplay{ - // Description: to.Ptr("Operation returns the list of Operations for a Resource Provider"), - // Operation: to.Ptr("List of Operations"), - // Provider: to.Ptr("Microsoft.DataProtection"), - // Resource: to.Ptr("Resource Provider Operation"), - // }, - // Origin: to.Ptr("user"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client.go index 935403753a70..59ea770c4bea 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -47,21 +46,24 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.getCreateRequest(ctx, location, operationID, options) if err != nil { return OperationStatusClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationStatusClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationStatusClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OperationStatusClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -81,7 +83,7 @@ func (client *OperationStatusClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client_example_test.go deleted file mode 100644 index aa412c523588..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatus_client_example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationStatusClient().Get(ctx, "WestUS", "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA==", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationResource = armdataprotection.OperationResource{ - // Name: to.Ptr("MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-20T09:49:46Z"); return t}()), - // ID: to.Ptr("/subscriptions/0b352192-dcac-4cc7-992e-a96190ccc68c/providers/Microsoft.DataProtection/locations/WestUS/operationStatus/MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-20T09:49:44.0478496Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client.go index d039adafedd7..1da23fe6b0f0 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -47,24 +46,27 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - options - OperationStatusBackupVaultContextClientGetOptions contains the optional parameters for the OperationStatusBackupVaultContextClient.Get // method. func (client *OperationStatusBackupVaultContextClient) Get(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *OperationStatusBackupVaultContextClientGetOptions) (OperationStatusBackupVaultContextClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, operationID, options) if err != nil { return OperationStatusBackupVaultContextClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationStatusBackupVaultContextClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationStatusBackupVaultContextClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OperationStatusBackupVaultContextClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -88,7 +90,7 @@ func (client *OperationStatusBackupVaultContextClient) getCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client_example_test.go deleted file mode 100644 index 53d3b49cb99d..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusbackupvaultcontext_client_example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationStatusBackupVaultContextClient().Get(ctx, "SampleResourceGroup", "swaggerExample", "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA==", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationResource = armdataprotection.OperationResource{ - // Name: to.Ptr("MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-20T09:49:46Z"); return t}()), - // ID: to.Ptr("/subscriptions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/backupVaults/swaggerExample/operationStatus/MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-20T09:49:44.0478496Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client.go index a531d3e3e3fb..0b7d75429b35 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -47,23 +46,26 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, operationID, options) if err != nil { return OperationStatusResourceGroupContextClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationStatusResourceGroupContextClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationStatusResourceGroupContextClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OperationStatusResourceGroupContextClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -83,7 +85,7 @@ func (client *OperationStatusResourceGroupContextClient) getCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client_example_test.go deleted file mode 100644 index 037ce93e4183..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/operationstatusresourcegroupcontext_client_example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationStatusResourceGroupContextClient().Get(ctx, "SampleResourceGroup", "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA==", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationResource = armdataprotection.OperationResource{ - // Name: to.Ptr("MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-20T09:49:46Z"); return t}()), - // ID: to.Ptr("/subscriptions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/operationStatus/MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-11-20T09:49:44.0478496Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/options.go b/sdk/resourcemanager/dataprotection/armdataprotection/options.go new file mode 100644 index 000000000000..2f5d717e8c88 --- /dev/null +++ b/sdk/resourcemanager/dataprotection/armdataprotection/options.go @@ -0,0 +1,451 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdataprotection + +// BackupInstancesClientBeginAdhocBackupOptions contains the optional parameters for the BackupInstancesClient.BeginAdhocBackup +// method. +type BackupInstancesClientBeginAdhocBackupOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupInstancesClient.BeginCreateOrUpdate +// method. +type BackupInstancesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginDeleteOptions contains the optional parameters for the BackupInstancesClient.BeginDelete method. +type BackupInstancesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginResumeBackupsOptions contains the optional parameters for the BackupInstancesClient.BeginResumeBackups +// method. +type BackupInstancesClientBeginResumeBackupsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginResumeProtectionOptions contains the optional parameters for the BackupInstancesClient.BeginResumeProtection +// method. +type BackupInstancesClientBeginResumeProtectionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginStopProtectionOptions contains the optional parameters for the BackupInstancesClient.BeginStopProtection +// method. +type BackupInstancesClientBeginStopProtectionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginSuspendBackupsOptions contains the optional parameters for the BackupInstancesClient.BeginSuspendBackups +// method. +type BackupInstancesClientBeginSuspendBackupsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginSyncBackupInstanceOptions contains the optional parameters for the BackupInstancesClient.BeginSyncBackupInstance +// method. +type BackupInstancesClientBeginSyncBackupInstanceOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginTriggerCrossRegionRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginTriggerCrossRegionRestore +// method. +type BackupInstancesClientBeginTriggerCrossRegionRestoreOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginTriggerRehydrateOptions contains the optional parameters for the BackupInstancesClient.BeginTriggerRehydrate +// method. +type BackupInstancesClientBeginTriggerRehydrateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginTriggerRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginTriggerRestore +// method. +type BackupInstancesClientBeginTriggerRestoreOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginValidateCrossRegionRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginValidateCrossRegionRestore +// method. +type BackupInstancesClientBeginValidateCrossRegionRestoreOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginValidateForBackupOptions contains the optional parameters for the BackupInstancesClient.BeginValidateForBackup +// method. +type BackupInstancesClientBeginValidateForBackupOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientBeginValidateForRestoreOptions contains the optional parameters for the BackupInstancesClient.BeginValidateForRestore +// method. +type BackupInstancesClientBeginValidateForRestoreOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupInstancesClientGetBackupInstanceOperationResultOptions contains the optional parameters for the BackupInstancesClient.GetBackupInstanceOperationResult +// method. +type BackupInstancesClientGetBackupInstanceOperationResultOptions struct { + // placeholder for future optional parameters +} + +// BackupInstancesClientGetOptions contains the optional parameters for the BackupInstancesClient.Get method. +type BackupInstancesClientGetOptions struct { + // placeholder for future optional parameters +} + +// BackupInstancesClientListOptions contains the optional parameters for the BackupInstancesClient.NewListPager method. +type BackupInstancesClientListOptions struct { + // placeholder for future optional parameters +} + +// BackupInstancesExtensionRoutingClientListOptions contains the optional parameters for the BackupInstancesExtensionRoutingClient.NewListPager +// method. +type BackupInstancesExtensionRoutingClientListOptions struct { + // placeholder for future optional parameters +} + +// BackupPoliciesClientCreateOrUpdateOptions contains the optional parameters for the BackupPoliciesClient.CreateOrUpdate +// method. +type BackupPoliciesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// BackupPoliciesClientDeleteOptions contains the optional parameters for the BackupPoliciesClient.Delete method. +type BackupPoliciesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// BackupPoliciesClientGetOptions contains the optional parameters for the BackupPoliciesClient.Get method. +type BackupPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// BackupPoliciesClientListOptions contains the optional parameters for the BackupPoliciesClient.NewListPager method. +type BackupPoliciesClientListOptions struct { + // placeholder for future optional parameters +} + +// BackupVaultOperationResultsClientGetOptions contains the optional parameters for the BackupVaultOperationResultsClient.Get +// method. +type BackupVaultOperationResultsClientGetOptions struct { + // placeholder for future optional parameters +} + +// BackupVaultsClientBeginCreateOrUpdateOptions contains the optional parameters for the BackupVaultsClient.BeginCreateOrUpdate +// method. +type BackupVaultsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupVaultsClientBeginDeleteOptions contains the optional parameters for the BackupVaultsClient.BeginDelete method. +type BackupVaultsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupVaultsClientBeginUpdateOptions contains the optional parameters for the BackupVaultsClient.BeginUpdate method. +type BackupVaultsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// BackupVaultsClientCheckNameAvailabilityOptions contains the optional parameters for the BackupVaultsClient.CheckNameAvailability +// method. +type BackupVaultsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// BackupVaultsClientGetInResourceGroupOptions contains the optional parameters for the BackupVaultsClient.NewGetInResourceGroupPager +// method. +type BackupVaultsClientGetInResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// BackupVaultsClientGetInSubscriptionOptions contains the optional parameters for the BackupVaultsClient.NewGetInSubscriptionPager +// method. +type BackupVaultsClientGetInSubscriptionOptions struct { + // placeholder for future optional parameters +} + +// BackupVaultsClientGetOptions contains the optional parameters for the BackupVaultsClient.Get method. +type BackupVaultsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ClientCheckFeatureSupportOptions contains the optional parameters for the Client.CheckFeatureSupport method. +type ClientCheckFeatureSupportOptions struct { + // placeholder for future optional parameters +} + +// CrossRegionRestoreJobClientGetOptions contains the optional parameters for the CrossRegionRestoreJobClient.Get method. +type CrossRegionRestoreJobClientGetOptions struct { + // placeholder for future optional parameters +} + +// CrossRegionRestoreJobsClientListOptions contains the optional parameters for the CrossRegionRestoreJobsClient.NewListPager +// method. +type CrossRegionRestoreJobsClientListOptions struct { + // placeholder for future optional parameters +} + +// 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.NewListPager +// method. +type DeletedBackupInstancesClientListOptions struct { + // placeholder for future optional parameters +} + +// DppResourceGuardProxyClientCreateOrUpdateOptions contains the optional parameters for the DppResourceGuardProxyClient.CreateOrUpdate +// method. +type DppResourceGuardProxyClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// DppResourceGuardProxyClientDeleteOptions contains the optional parameters for the DppResourceGuardProxyClient.Delete method. +type DppResourceGuardProxyClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// DppResourceGuardProxyClientGetOptions contains the optional parameters for the DppResourceGuardProxyClient.Get method. +type DppResourceGuardProxyClientGetOptions struct { + // placeholder for future optional parameters +} + +// DppResourceGuardProxyClientListOptions contains the optional parameters for the DppResourceGuardProxyClient.NewListPager +// method. +type DppResourceGuardProxyClientListOptions struct { + // placeholder for future optional parameters +} + +// DppResourceGuardProxyClientUnlockDeleteOptions contains the optional parameters for the DppResourceGuardProxyClient.UnlockDelete +// method. +type DppResourceGuardProxyClientUnlockDeleteOptions struct { + // placeholder for future optional parameters +} + +// ExportJobsClientBeginTriggerOptions contains the optional parameters for the ExportJobsClient.BeginTrigger method. +type ExportJobsClientBeginTriggerOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExportJobsOperationResultClientGetOptions contains the optional parameters for the ExportJobsOperationResultClient.Get +// method. +type ExportJobsOperationResultClientGetOptions struct { + // placeholder for future optional parameters +} + +// JobsClientBeginTriggerCancelOptions contains the optional parameters for the JobsClient.BeginTriggerCancel method. +type JobsClientBeginTriggerCancelOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// JobsClientGenerateProgressURLOptions contains the optional parameters for the JobsClient.GenerateProgressURL method. +type JobsClientGenerateProgressURLOptions struct { + // placeholder for future optional parameters +} + +// JobsClientGetOptions contains the optional parameters for the JobsClient.Get method. +type JobsClientGetOptions struct { + // placeholder for future optional parameters +} + +// JobsClientListOptions contains the optional parameters for the JobsClient.NewListPager method. +type JobsClientListOptions struct { + // placeholder for future optional parameters +} + +// OperationResultClientGetOptions contains the optional parameters for the OperationResultClient.Get method. +type OperationResultClientGetOptions struct { + // placeholder for future optional parameters +} + +// OperationStatusBackupVaultContextClientGetOptions contains the optional parameters for the OperationStatusBackupVaultContextClient.Get +// method. +type OperationStatusBackupVaultContextClientGetOptions struct { + // placeholder for future optional parameters +} + +// OperationStatusClientGetOptions contains the optional parameters for the OperationStatusClient.Get method. +type OperationStatusClientGetOptions struct { + // placeholder for future optional parameters +} + +// OperationStatusResourceGroupContextClientGetOptions contains the optional parameters for the OperationStatusResourceGroupContextClient.Get +// method. +type OperationStatusResourceGroupContextClientGetOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. +type RecoveryPointsClientGetOptions struct { + // placeholder for future optional parameters +} + +// RecoveryPointsClientListOptions contains the optional parameters for the RecoveryPointsClient.NewListPager method. +type RecoveryPointsClientListOptions struct { + // OData filter options. + Filter *string + + // skipToken Filter. + SkipToken *string +} + +// ResourceGuardsClientDeleteOptions contains the optional parameters for the ResourceGuardsClient.Delete method. +type ResourceGuardsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientGetBackupSecurityPINRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetBackupSecurityPINRequestsObjectsPager +// method. +type ResourceGuardsClientGetBackupSecurityPINRequestsObjectsOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectOptions contains the optional parameters for the ResourceGuardsClient.GetDefaultBackupSecurityPINRequestsObject +// method. +type ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectOptions contains the optional parameters for the ResourceGuardsClient.GetDefaultDeleteProtectedItemRequestsObject +// method. +type ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectOptions contains the optional parameters for the ResourceGuardsClient.GetDefaultDeleteResourceGuardProxyRequestsObject +// method. +type ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectOptions contains the optional parameters for the ResourceGuardsClient.GetDefaultDisableSoftDeleteRequestsObject +// method. +type ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectOptions contains the optional parameters for the ResourceGuardsClient.GetDefaultUpdateProtectedItemRequestsObject +// method. +type ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectOptions contains the optional parameters for the ResourceGuardsClient.GetDefaultUpdateProtectionPolicyRequestsObject +// method. +type ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetDeleteProtectedItemRequestsObjectsPager +// method. +type ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetDeleteResourceGuardProxyRequestsObjectsPager +// method. +type ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetDisableSoftDeleteRequestsObjectsPager +// method. +type ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientGetOptions contains the optional parameters for the ResourceGuardsClient.Get method. +type ResourceGuardsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientGetResourcesInResourceGroupOptions contains the optional parameters for the ResourceGuardsClient.NewGetResourcesInResourceGroupPager +// method. +type ResourceGuardsClientGetResourcesInResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientGetResourcesInSubscriptionOptions contains the optional parameters for the ResourceGuardsClient.NewGetResourcesInSubscriptionPager +// method. +type ResourceGuardsClientGetResourcesInSubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetUpdateProtectedItemRequestsObjectsPager +// method. +type ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetUpdateProtectionPolicyRequestsObjectsPager +// method. +type ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientPatchOptions contains the optional parameters for the ResourceGuardsClient.Patch method. +type ResourceGuardsClientPatchOptions struct { + // placeholder for future optional parameters +} + +// ResourceGuardsClientPutOptions contains the optional parameters for the ResourceGuardsClient.Put method. +type ResourceGuardsClientPutOptions struct { + // placeholder for future optional parameters +} + +// RestorableTimeRangesClientFindOptions contains the optional parameters for the RestorableTimeRangesClient.Find method. +type RestorableTimeRangesClientFindOptions struct { + // placeholder for future optional parameters +} + +// SecondaryRPsClientFetchOptions contains the optional parameters for the SecondaryRPsClient.NewFetchPager method. +type SecondaryRPsClientFetchOptions struct { + // OData filter options. + Filter *string + + // skipToken Filter. + SkipToken *string +} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/polymorphic_helpers.go b/sdk/resourcemanager/dataprotection/armdataprotection/polymorphic_helpers.go index 91bb0473a888..0a75e5ce1c6b 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/polymorphic_helpers.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/polymorphic_helpers.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -26,7 +25,10 @@ func unmarshalAuthCredentialsClassification(rawMsg json.RawMessage) (AuthCredent default: b = &AuthCredentials{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalAzureBackupRecoveryPointClassification(rawMsg json.RawMessage) (AzureBackupRecoveryPointClassification, error) { @@ -44,7 +46,10 @@ func unmarshalAzureBackupRecoveryPointClassification(rawMsg json.RawMessage) (Az default: b = &AzureBackupRecoveryPoint{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalAzureBackupRestoreRequestClassification(rawMsg json.RawMessage) (AzureBackupRestoreRequestClassification, error) { @@ -66,7 +71,10 @@ func unmarshalAzureBackupRestoreRequestClassification(rawMsg json.RawMessage) (A default: b = &AzureBackupRestoreRequest{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalBackupCriteriaClassification(rawMsg json.RawMessage) (BackupCriteriaClassification, error) { @@ -84,7 +92,10 @@ func unmarshalBackupCriteriaClassification(rawMsg json.RawMessage) (BackupCriter default: b = &BackupCriteria{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalBackupCriteriaClassificationArray(rawMsg json.RawMessage) ([]BackupCriteriaClassification, error) { @@ -123,7 +134,10 @@ func unmarshalBackupDatasourceParametersClassification(rawMsg json.RawMessage) ( default: b = &BackupDatasourceParameters{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalBackupDatasourceParametersClassificationArray(rawMsg json.RawMessage) ([]BackupDatasourceParametersClassification, error) { @@ -160,7 +174,10 @@ func unmarshalBackupParametersClassification(rawMsg json.RawMessage) (BackupPara default: b = &BackupParameters{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalBaseBackupPolicyClassification(rawMsg json.RawMessage) (BaseBackupPolicyClassification, error) { @@ -178,7 +195,10 @@ func unmarshalBaseBackupPolicyClassification(rawMsg json.RawMessage) (BaseBackup default: b = &BaseBackupPolicy{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalBasePolicyRuleClassification(rawMsg json.RawMessage) (BasePolicyRuleClassification, error) { @@ -198,7 +218,10 @@ func unmarshalBasePolicyRuleClassification(rawMsg json.RawMessage) (BasePolicyRu default: b = &BasePolicyRule{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalBasePolicyRuleClassificationArray(rawMsg json.RawMessage) ([]BasePolicyRuleClassification, error) { @@ -230,10 +253,15 @@ func unmarshalBaseResourcePropertiesClassification(rawMsg json.RawMessage) (Base } var b BaseResourcePropertiesClassification switch m["objectType"] { + case string(ResourcePropertiesObjectTypeDefaultResourceProperties): + b = &DefaultResourceProperties{} default: b = &BaseResourceProperties{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalCopyOptionClassification(rawMsg json.RawMessage) (CopyOptionClassification, error) { @@ -255,7 +283,10 @@ func unmarshalCopyOptionClassification(rawMsg json.RawMessage) (CopyOptionClassi default: b = &CopyOption{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalDataStoreParametersClassification(rawMsg json.RawMessage) (DataStoreParametersClassification, error) { @@ -273,7 +304,10 @@ func unmarshalDataStoreParametersClassification(rawMsg json.RawMessage) (DataSto default: b = &DataStoreParameters{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalDataStoreParametersClassificationArray(rawMsg json.RawMessage) ([]DataStoreParametersClassification, error) { @@ -310,7 +344,10 @@ func unmarshalDeleteOptionClassification(rawMsg json.RawMessage) (DeleteOptionCl default: b = &DeleteOption{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalFeatureValidationResponseBaseClassification(rawMsg json.RawMessage) (FeatureValidationResponseBaseClassification, error) { @@ -328,7 +365,10 @@ func unmarshalFeatureValidationResponseBaseClassification(rawMsg json.RawMessage default: b = &FeatureValidationResponseBase{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalItemLevelRestoreCriteriaClassification(rawMsg json.RawMessage) (ItemLevelRestoreCriteriaClassification, error) { @@ -354,7 +394,10 @@ func unmarshalItemLevelRestoreCriteriaClassification(rawMsg json.RawMessage) (It default: b = &ItemLevelRestoreCriteria{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalItemLevelRestoreCriteriaClassificationArray(rawMsg json.RawMessage) ([]ItemLevelRestoreCriteriaClassification, error) { @@ -391,7 +434,10 @@ func unmarshalOperationExtendedInfoClassification(rawMsg json.RawMessage) (Opera default: b = &OperationExtendedInfo{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalRestoreTargetInfoBaseClassification(rawMsg json.RawMessage) (RestoreTargetInfoBaseClassification, error) { @@ -413,7 +459,10 @@ func unmarshalRestoreTargetInfoBaseClassification(rawMsg json.RawMessage) (Resto default: b = &RestoreTargetInfoBase{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalTriggerContextClassification(rawMsg json.RawMessage) (TriggerContextClassification, error) { @@ -433,5 +482,8 @@ func unmarshalTriggerContextClassification(rawMsg json.RawMessage) (TriggerConte default: b = &TriggerContext{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client.go index 194676831677..dfe4d6e26928 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -47,24 +46,27 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The name of the backup vault. // - backupInstanceName - The name of the backup instance. // - options - RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. func (client *RecoveryPointsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, recoveryPointID string, options *RecoveryPointsClientGetOptions) (RecoveryPointsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, recoveryPointID, options) if err != nil { return RecoveryPointsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RecoveryPointsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RecoveryPointsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RecoveryPointsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -92,7 +94,7 @@ func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,7 +111,7 @@ func (client *RecoveryPointsClient) getHandleResponse(resp *http.Response) (Reco // NewListPager - Returns a list of Recovery Points for a DataSource in a vault. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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. @@ -163,7 +165,7 @@ func (client *RecoveryPointsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client_example_test.go deleted file mode 100644 index bfcb99205a21..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/recoverypoints_client_example_test.go +++ /dev/null @@ -1,141 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecoveryPointsClient().NewListPager("000pikumar", "PratikPrivatePreviewVault1", "testInstance1", &armdataprotection.RecoveryPointsClientListOptions{Filter: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AzureBackupRecoveryPointResourceList = armdataprotection.AzureBackupRecoveryPointResourceList{ - // Value: []*armdataprotection.AzureBackupRecoveryPointResource{ - // { - // Name: to.Ptr("7fb2cddd-c5b3-44f6-a0d9-db3c4f9d5e35"), - // Type: to.Ptr("microsoft.dataprotection/backupvaults/backupInstances/recoveryPoints"), - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/HelloTest/providers/Microsoft.DataProtection/backupVaults/HelloTestVault/backupInstances/653213d-c5b3-44f6-a0d9-db3c4f9d8e34/recoveryPoints/7fb2cddd-c5b3-44f6-a0d9-db3c4f9d5f25"), - // Properties: &armdataprotection.AzureBackupDiscreteRecoveryPoint{ - // ObjectType: to.Ptr("AzureBackupDiscreteRecoveryPoint"), - // ExpiryTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T13:00:00Z"); return t}()), - // FriendlyName: to.Ptr("panbha4"), - // RecoveryPointDataStoresDetails: []*armdataprotection.RecoveryPointDataStoreDetails{ - // { - // Type: to.Ptr("Snapshot"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T13:00:00Z"); return t}()), - // ID: to.Ptr("0ff03512-b333-4509-a6c7-12164c8b1dce"), - // MetaData: to.Ptr("123456"), - // }, - // { - // Type: to.Ptr("BackupStorage"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T13:00:00Z"); return t}()), - // ID: to.Ptr("5d8cfd30-722e-4bab-85f6-4a9d01ffc6f1"), - // MetaData: to.Ptr("123456"), - // }}, - // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T13:00:00Z"); return t}()), - // RecoveryPointType: to.Ptr("Full"), - // }, - // }, - // { - // Name: to.Ptr("7fb2cddd-c5b3-44f6-a0d9-db3c4f9d5f25"), - // Type: to.Ptr("microsoft.dataprotection/backupvaults/backupInstances/recoveryPoints"), - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/HelloTest/providers/Microsoft.DataProtection/backupVaults/HelloTestVault/backupInstances/653213d-c5b3-44f6-a0d9-db3c4f9d8e34/recoveryPoints/7fb2cddd-c5b3-44f6-a0d9-db3c4f9d5f25"), - // Properties: &armdataprotection.AzureBackupDiscreteRecoveryPoint{ - // ObjectType: to.Ptr("AzureBackupDiscreteRecoveryPoint"), - // FriendlyName: to.Ptr("panbha4"), - // RecoveryPointDataStoresDetails: []*armdataprotection.RecoveryPointDataStoreDetails{ - // { - // Type: to.Ptr("Snapshot"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T13:00:00Z"); return t}()), - // ID: to.Ptr("808cfd30-722e-4bab-85f6-4a9d01ffc6f2"), - // MetaData: to.Ptr("123456"), - // }, - // { - // Type: to.Ptr("BackupStorage"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T13:00:00Z"); return t}()), - // ID: to.Ptr("798cfd30-722e-4bab-85f6-4a9d01ffc6f3"), - // MetaData: to.Ptr("123456"), - // }}, - // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T13:00:00Z"); return t}()), - // RecoveryPointType: to.Ptr("Full"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecoveryPointsClient().Get(ctx, "000pikumar", "PratikPrivatePreviewVault1", "testInstance1", "7fb2cddd-c5b3-44f6-a0d9-db3c4f9d5f25", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureBackupRecoveryPointResource = armdataprotection.AzureBackupRecoveryPointResource{ - // Name: to.Ptr("7fb2cddd-c5b3-44f6-a0d9-db3c4f9d5f25"), - // Type: to.Ptr("microsoft.dataprotection/backupvaults/backupInstances/recoveryPoints"), - // ID: to.Ptr("/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/HelloTest/providers/Microsoft.DataProtection/backupVaults/HelloTestVault/backupInstances/653213d-c5b3-44f6-a0d9-db3c4f9d8e34/recoveryPoints/7fb2cddd-c5b3-44f6-a0d9-db3c4f9d5f25"), - // Properties: &armdataprotection.AzureBackupDiscreteRecoveryPoint{ - // ObjectType: to.Ptr("AzureBackupDiscreteRecoveryPoint"), - // FriendlyName: to.Ptr("panbha4"), - // RecoveryPointDataStoresDetails: []*armdataprotection.RecoveryPointDataStoreDetails{ - // { - // Type: to.Ptr("Snapshot"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T13:00:00Z"); return t}()), - // ID: to.Ptr("0ff03512-b333-4509-a6c7-12164c8b1dce"), - // MetaData: to.Ptr("123456"), - // }, - // { - // Type: to.Ptr("BackupStorage"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T13:00:00Z"); return t}()), - // ID: to.Ptr("5d8cfd30-722e-4bab-85f6-4a9d01ffc6f1"), - // MetaData: to.Ptr("123456"), - // }}, - // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-01T13:00:00Z"); return t}()), - // RecoveryPointType: to.Ptr("Full"), - // }, - // } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client.go index 37e7c485e059..5c2e1bc5dc72 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -47,21 +46,23 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceGuardsName, options) if err != nil { return ResourceGuardsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceGuardsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ResourceGuardsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ResourceGuardsClientDeleteResponse{}, err } return ResourceGuardsClientDeleteResponse{}, nil } @@ -83,7 +84,7 @@ func (client *ResourceGuardsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -92,23 +93,26 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceGuardsName, options) if err != nil { return ResourceGuardsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceGuardsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceGuardsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceGuardsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -128,7 +132,7 @@ func (client *ResourceGuardsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -146,7 +150,7 @@ func (client *ResourceGuardsClient) getHandleResponse(resp *http.Response) (Reso // NewGetBackupSecurityPINRequestsObjectsPager - Returns collection of operation request objects for a critical operation // protected by the given ResourceGuard resource. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ResourceGuardsClientGetBackupSecurityPINRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetBackupSecurityPINRequestsObjectsPager // method. @@ -195,7 +199,7 @@ func (client *ResourceGuardsClient) getBackupSecurityPINRequestsObjectsCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,23 +218,26 @@ func (client *ResourceGuardsClient) getBackupSecurityPINRequestsObjectsHandleRes // by the given ResourceGuard resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.getDefaultBackupSecurityPINRequestsObjectCreateRequest(ctx, resourceGroupName, resourceGuardsName, requestName, options) if err != nil { return ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResponse{}, err } - return client.getDefaultBackupSecurityPINRequestsObjectHandleResponse(resp) + resp, err := client.getDefaultBackupSecurityPINRequestsObjectHandleResponse(httpResp) + return resp, err } // getDefaultBackupSecurityPINRequestsObjectCreateRequest creates the GetDefaultBackupSecurityPINRequestsObject request. @@ -254,7 +261,7 @@ func (client *ResourceGuardsClient) getDefaultBackupSecurityPINRequestsObjectCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -273,23 +280,26 @@ func (client *ResourceGuardsClient) getDefaultBackupSecurityPINRequestsObjectHan // protected by the given ResourceGuard resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.getDefaultDeleteProtectedItemRequestsObjectCreateRequest(ctx, resourceGroupName, resourceGuardsName, requestName, options) if err != nil { return ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResponse{}, err } - return client.getDefaultDeleteProtectedItemRequestsObjectHandleResponse(resp) + resp, err := client.getDefaultDeleteProtectedItemRequestsObjectHandleResponse(httpResp) + return resp, err } // getDefaultDeleteProtectedItemRequestsObjectCreateRequest creates the GetDefaultDeleteProtectedItemRequestsObject request. @@ -313,7 +323,7 @@ func (client *ResourceGuardsClient) getDefaultDeleteProtectedItemRequestsObjectC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -332,23 +342,26 @@ func (client *ResourceGuardsClient) getDefaultDeleteProtectedItemRequestsObjectH // protected by the given ResourceGuard resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.getDefaultDeleteResourceGuardProxyRequestsObjectCreateRequest(ctx, resourceGroupName, resourceGuardsName, requestName, options) if err != nil { return ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResponse{}, err } - return client.getDefaultDeleteResourceGuardProxyRequestsObjectHandleResponse(resp) + resp, err := client.getDefaultDeleteResourceGuardProxyRequestsObjectHandleResponse(httpResp) + return resp, err } // getDefaultDeleteResourceGuardProxyRequestsObjectCreateRequest creates the GetDefaultDeleteResourceGuardProxyRequestsObject request. @@ -372,7 +385,7 @@ func (client *ResourceGuardsClient) getDefaultDeleteResourceGuardProxyRequestsOb return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -391,23 +404,26 @@ func (client *ResourceGuardsClient) getDefaultDeleteResourceGuardProxyRequestsOb // by the given ResourceGuard resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.getDefaultDisableSoftDeleteRequestsObjectCreateRequest(ctx, resourceGroupName, resourceGuardsName, requestName, options) if err != nil { return ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResponse{}, err } - return client.getDefaultDisableSoftDeleteRequestsObjectHandleResponse(resp) + resp, err := client.getDefaultDisableSoftDeleteRequestsObjectHandleResponse(httpResp) + return resp, err } // getDefaultDisableSoftDeleteRequestsObjectCreateRequest creates the GetDefaultDisableSoftDeleteRequestsObject request. @@ -431,7 +447,7 @@ func (client *ResourceGuardsClient) getDefaultDisableSoftDeleteRequestsObjectCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -450,23 +466,26 @@ func (client *ResourceGuardsClient) getDefaultDisableSoftDeleteRequestsObjectHan // protected by the given ResourceGuard resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.getDefaultUpdateProtectedItemRequestsObjectCreateRequest(ctx, resourceGroupName, resourceGuardsName, requestName, options) if err != nil { return ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResponse{}, err } - return client.getDefaultUpdateProtectedItemRequestsObjectHandleResponse(resp) + resp, err := client.getDefaultUpdateProtectedItemRequestsObjectHandleResponse(httpResp) + return resp, err } // getDefaultUpdateProtectedItemRequestsObjectCreateRequest creates the GetDefaultUpdateProtectedItemRequestsObject request. @@ -490,7 +509,7 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectedItemRequestsObjectC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -509,23 +528,26 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectedItemRequestsObjectH // protected by the given ResourceGuard resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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) { + var err error req, err := client.getDefaultUpdateProtectionPolicyRequestsObjectCreateRequest(ctx, resourceGroupName, resourceGuardsName, requestName, options) if err != nil { return ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse{}, err } - return client.getDefaultUpdateProtectionPolicyRequestsObjectHandleResponse(resp) + resp, err := client.getDefaultUpdateProtectionPolicyRequestsObjectHandleResponse(httpResp) + return resp, err } // getDefaultUpdateProtectionPolicyRequestsObjectCreateRequest creates the GetDefaultUpdateProtectionPolicyRequestsObject request. @@ -549,7 +571,7 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectionPolicyRequestsObje return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -567,7 +589,7 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectionPolicyRequestsObje // NewGetDeleteProtectedItemRequestsObjectsPager - Returns collection of operation request objects for a critical operation // protected by the given ResourceGuard resource. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetDeleteProtectedItemRequestsObjectsPager // method. @@ -616,7 +638,7 @@ func (client *ResourceGuardsClient) getDeleteProtectedItemRequestsObjectsCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -634,7 +656,7 @@ func (client *ResourceGuardsClient) getDeleteProtectedItemRequestsObjectsHandleR // NewGetDeleteResourceGuardProxyRequestsObjectsPager - Returns collection of operation request objects for a critical operation // protected by the given ResourceGuard resource. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsOptions contains the optional parameters for the // ResourceGuardsClient.NewGetDeleteResourceGuardProxyRequestsObjectsPager method. @@ -683,7 +705,7 @@ func (client *ResourceGuardsClient) getDeleteResourceGuardProxyRequestsObjectsCr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -701,7 +723,7 @@ func (client *ResourceGuardsClient) getDeleteResourceGuardProxyRequestsObjectsHa // NewGetDisableSoftDeleteRequestsObjectsPager - Returns collection of operation request objects for a critical operation // protected by the given ResourceGuard resource. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetDisableSoftDeleteRequestsObjectsPager // method. @@ -750,7 +772,7 @@ func (client *ResourceGuardsClient) getDisableSoftDeleteRequestsObjectsCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -767,7 +789,7 @@ func (client *ResourceGuardsClient) getDisableSoftDeleteRequestsObjectsHandleRes // NewGetResourcesInResourceGroupPager - Returns ResourceGuards collection belonging to a ResourceGroup. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ResourceGuardsClientGetResourcesInResourceGroupOptions contains the optional parameters for the ResourceGuardsClient.NewGetResourcesInResourceGroupPager // method. @@ -812,7 +834,7 @@ func (client *ResourceGuardsClient) getResourcesInResourceGroupCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -829,7 +851,7 @@ func (client *ResourceGuardsClient) getResourcesInResourceGroupHandleResponse(re // NewGetResourcesInSubscriptionPager - Returns ResourceGuards collection belonging to a subscription. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - options - ResourceGuardsClientGetResourcesInSubscriptionOptions contains the optional parameters for the ResourceGuardsClient.NewGetResourcesInSubscriptionPager // method. func (client *ResourceGuardsClient) NewGetResourcesInSubscriptionPager(options *ResourceGuardsClientGetResourcesInSubscriptionOptions) *runtime.Pager[ResourceGuardsClientGetResourcesInSubscriptionResponse] { @@ -869,7 +891,7 @@ func (client *ResourceGuardsClient) getResourcesInSubscriptionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -887,7 +909,7 @@ func (client *ResourceGuardsClient) getResourcesInSubscriptionHandleResponse(res // NewGetUpdateProtectedItemRequestsObjectsPager - Returns collection of operation request objects for a critical operation // protected by the given ResourceGuard resource. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsOptions contains the optional parameters for the ResourceGuardsClient.NewGetUpdateProtectedItemRequestsObjectsPager // method. @@ -936,7 +958,7 @@ func (client *ResourceGuardsClient) getUpdateProtectedItemRequestsObjectsCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -954,7 +976,7 @@ func (client *ResourceGuardsClient) getUpdateProtectedItemRequestsObjectsHandleR // NewGetUpdateProtectionPolicyRequestsObjectsPager - Returns collection of operation request objects for a critical operation // protected by the given ResourceGuard resource. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsOptions contains the optional parameters for the // ResourceGuardsClient.NewGetUpdateProtectionPolicyRequestsObjectsPager method. @@ -1003,7 +1025,7 @@ func (client *ResourceGuardsClient) getUpdateProtectionPolicyRequestsObjectsCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1021,24 +1043,27 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceGuardsName - The name of ResourceGuard // - parameters - Request body for operation // - options - ResourceGuardsClientPatchOptions contains the optional parameters for the ResourceGuardsClient.Patch method. func (client *ResourceGuardsClient) Patch(ctx context.Context, resourceGroupName string, resourceGuardsName string, parameters PatchResourceGuardInput, options *ResourceGuardsClientPatchOptions) (ResourceGuardsClientPatchResponse, error) { + var err error req, err := client.patchCreateRequest(ctx, resourceGroupName, resourceGuardsName, parameters, options) if err != nil { return ResourceGuardsClientPatchResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceGuardsClientPatchResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceGuardsClientPatchResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ResourceGuardsClientPatchResponse{}, err } - return client.patchHandleResponse(resp) + resp, err := client.patchHandleResponse(httpResp) + return resp, err } // patchCreateRequest creates the Patch request. @@ -1058,10 +1083,13 @@ func (client *ResourceGuardsClient) patchCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // patchHandleResponse handles the Patch response. @@ -1076,24 +1104,27 @@ 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 2023-05-01 +// Generated from API version 2023-06-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceGuardsName - The name of ResourceGuard // - parameters - Request body for operation // - options - ResourceGuardsClientPutOptions contains the optional parameters for the ResourceGuardsClient.Put method. func (client *ResourceGuardsClient) Put(ctx context.Context, resourceGroupName string, resourceGuardsName string, parameters ResourceGuardResource, options *ResourceGuardsClientPutOptions) (ResourceGuardsClientPutResponse, error) { + var err error req, err := client.putCreateRequest(ctx, resourceGroupName, resourceGuardsName, parameters, options) if err != nil { return ResourceGuardsClientPutResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ResourceGuardsClientPutResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ResourceGuardsClientPutResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ResourceGuardsClientPutResponse{}, err } - return client.putHandleResponse(resp) + resp, err := client.putHandleResponse(httpResp) + return resp, err } // putCreateRequest creates the Put request. @@ -1113,10 +1144,13 @@ func (client *ResourceGuardsClient) putCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // putHandleResponse handles the Put response. diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client_example_test.go deleted file mode 100644 index f91551beb6f3..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/resourceguards_client_example_test.go +++ /dev/null @@ -1,632 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceGuardsClient().NewGetResourcesInSubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceGuardResourceList = armdataprotection.ResourceGuardResourceList{ - // Value: []*armdataprotection.ResourceGuardResource{ - // { - // Name: to.Ptr("VaultGuardTestNew"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards"), - // ID: to.Ptr("/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "TestKey": to.Ptr("TestValue"), - // }, - // Properties: &armdataprotection.ResourceGuard{ - // Description: to.Ptr("Please take JIT access before performing any of the critical operation"), - // AllowAutoApprovals: to.Ptr(true), - // ProvisioningState: to.Ptr(armdataprotection.ProvisioningStateSucceeded), - // ResourceGuardOperations: []*armdataprotection.ResourceGuardOperation{ - // { - // RequestResourceType: to.Ptr("Microsoft.DataProtection/resourceGuards/deleteResourceGuardProxyRequests"), - // VaultCriticalOperation: to.Ptr("Microsoft.RecoveryServices/vaults/backupResourceGuardProxies/delete"), - // }, - // { - // RequestResourceType: to.Ptr("Microsoft.DataProtection/resourceGuards/disableSoftDeleteRequests"), - // VaultCriticalOperation: to.Ptr("Microsoft.RecoveryServices/vaults/backupconfig/write"), - // }}, - // VaultCriticalOperationExclusionList: []*string{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceGuardsClient().NewGetResourcesInResourceGroupPager("SampleResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceGuardResourceList = armdataprotection.ResourceGuardResourceList{ - // Value: []*armdataprotection.ResourceGuardResource{ - // { - // Name: to.Ptr("VaultGuardTestNew"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards"), - // ID: to.Ptr("/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "TestKey": to.Ptr("TestValue"), - // }, - // Properties: &armdataprotection.ResourceGuard{ - // Description: to.Ptr("Please take JIT access before performing any of the critical operation"), - // AllowAutoApprovals: to.Ptr(true), - // ProvisioningState: to.Ptr(armdataprotection.ProvisioningStateSucceeded), - // ResourceGuardOperations: []*armdataprotection.ResourceGuardOperation{ - // { - // RequestResourceType: to.Ptr("Microsoft.DataProtection/resourceGuards/deleteResourceGuardProxyRequests"), - // VaultCriticalOperation: to.Ptr("Microsoft.RecoveryServices/vaults/backupResourceGuardProxies/delete"), - // }, - // { - // RequestResourceType: to.Ptr("Microsoft.DataProtection/resourceGuards/disableSoftDeleteRequests"), - // VaultCriticalOperation: to.Ptr("Microsoft.RecoveryServices/vaults/backupconfig/write"), - // }}, - // VaultCriticalOperationExclusionList: []*string{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceGuardsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ResourceGuardResource = armdataprotection.ResourceGuardResource{ - // Name: to.Ptr("VaultGuardTestNew"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards"), - // ID: to.Ptr("/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "TestKey": to.Ptr("TestValue"), - // }, - // Properties: &armdataprotection.ResourceGuard{ - // Description: to.Ptr("Please take JIT access before performing any of the critical operation"), - // AllowAutoApprovals: to.Ptr(true), - // ProvisioningState: to.Ptr(armdataprotection.ProvisioningStateSucceeded), - // ResourceGuardOperations: []*armdataprotection.ResourceGuardOperation{ - // { - // RequestResourceType: to.Ptr("Microsoft.DataProtection/resourceGuards/deleteResourceGuardProxyRequests"), - // VaultCriticalOperation: to.Ptr("Microsoft.RecoveryServices/vaults/backupResourceGuardProxies/delete"), - // }, - // { - // RequestResourceType: to.Ptr("Microsoft.DataProtection/resourceGuards/disableSoftDeleteRequests"), - // VaultCriticalOperation: to.Ptr("Microsoft.RecoveryServices/vaults/backupconfig/write"), - // }}, - // VaultCriticalOperationExclusionList: []*string{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceGuardsClient().Get(ctx, "SampleResourceGroup", "swaggerExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ResourceGuardResource = armdataprotection.ResourceGuardResource{ - // Name: to.Ptr("ResourceGuardTestNew"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards"), - // ID: to.Ptr("/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "TestKey": to.Ptr("TestValue"), - // }, - // Properties: &armdataprotection.ResourceGuard{ - // Description: to.Ptr("Please take JIT access before performing any of the critical operation"), - // AllowAutoApprovals: to.Ptr(true), - // ProvisioningState: to.Ptr(armdataprotection.ProvisioningStateSucceeded), - // ResourceGuardOperations: []*armdataprotection.ResourceGuardOperation{ - // { - // RequestResourceType: to.Ptr("Microsoft.DataProtection/resourceGuards/deleteResourceGuardProxyRequests"), - // VaultCriticalOperation: to.Ptr("Microsoft.RecoveryServices/vaults/backupResourceGuardProxies/delete"), - // }, - // { - // RequestResourceType: to.Ptr("Microsoft.DataProtection/resourceGuards/disableSoftDeleteRequests"), - // VaultCriticalOperation: to.Ptr("Microsoft.RecoveryServices/vaults/backupconfig/write"), - // }}, - // VaultCriticalOperationExclusionList: []*string{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewResourceGuardsClient().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/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceGuardsClient().Patch(ctx, "SampleResourceGroup", "swaggerExample", armdataprotection.PatchResourceGuardInput{ - Tags: map[string]*string{ - "newKey": to.Ptr("newVal"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ResourceGuardResource = armdataprotection.ResourceGuardResource{ - // Name: to.Ptr("VaultGuardTestNew"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards"), - // ID: to.Ptr("/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "TestKey": to.Ptr("TestValue"), - // }, - // Properties: &armdataprotection.ResourceGuard{ - // Description: to.Ptr("Please take JIT access before performing any of the critical operation"), - // AllowAutoApprovals: to.Ptr(true), - // ProvisioningState: to.Ptr(armdataprotection.ProvisioningStateSucceeded), - // ResourceGuardOperations: []*armdataprotection.ResourceGuardOperation{ - // { - // RequestResourceType: to.Ptr("Microsoft.DataProtection/resourceGuards/deleteResourceGuardProxyRequests"), - // VaultCriticalOperation: to.Ptr("Microsoft.RecoveryServices/vaults/backupResourceGuardProxies/delete"), - // }, - // { - // RequestResourceType: to.Ptr("Microsoft.DataProtection/resourceGuards/disableSoftDeleteRequests"), - // VaultCriticalOperation: to.Ptr("Microsoft.RecoveryServices/vaults/backupconfig/write"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceGuardsClient().NewGetDisableSoftDeleteRequestsObjectsPager("SampleResourceGroup", "swaggerExample", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DppBaseResourceList = armdataprotection.DppBaseResourceList{ - // Value: []*armdataprotection.DppBaseResource{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards/disableSoftDeleteRequests"), - // ID: to.Ptr("subscriotions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/resourceGuards/swaggerExample/disableSoftDeleteRequests/default"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceGuardsClient().NewGetDeleteResourceGuardProxyRequestsObjectsPager("SampleResourceGroup", "swaggerExample", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DppBaseResourceList = armdataprotection.DppBaseResourceList{ - // Value: []*armdataprotection.DppBaseResource{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards/deleteResourceGuardProxyRequests"), - // ID: to.Ptr("subscriotions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/resourceGuards/swaggerExample/deleteResourceGuardProxyRequests/default"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceGuardsClient().NewGetBackupSecurityPINRequestsObjectsPager("SampleResourceGroup", "swaggerExample", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DppBaseResourceList = armdataprotection.DppBaseResourceList{ - // Value: []*armdataprotection.DppBaseResource{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards/getBackupSecurityPINRequests"), - // ID: to.Ptr("subscriotions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/resourceGuards/swaggerExample/getBackupSecurityPINRequests/default"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceGuardsClient().NewGetDeleteProtectedItemRequestsObjectsPager("SampleResourceGroup", "swaggerExample", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DppBaseResourceList = armdataprotection.DppBaseResourceList{ - // Value: []*armdataprotection.DppBaseResource{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards/deleteProtectedItemRequests"), - // ID: to.Ptr("subscriotions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/resourceGuards/swaggerExample/deleteProtectedItemRequests/default"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceGuardsClient().NewGetUpdateProtectionPolicyRequestsObjectsPager("SampleResourceGroup", "swaggerExample", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DppBaseResourceList = armdataprotection.DppBaseResourceList{ - // Value: []*armdataprotection.DppBaseResource{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards/updateProtectionPolicyRequests"), - // ID: to.Ptr("subscriotions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/resourceGuards/swaggerExample/updateProtectionPolicyRequests/default"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewResourceGuardsClient().NewGetUpdateProtectedItemRequestsObjectsPager("SampleResourceGroup", "swaggerExample", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DppBaseResourceList = armdataprotection.DppBaseResourceList{ - // Value: []*armdataprotection.DppBaseResource{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards/updateProtectedItemRequests"), - // ID: to.Ptr("subscriotions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/resourceGuards/swaggerExample/updateProtectedItemRequests/default"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceGuardsClient().GetDefaultDisableSoftDeleteRequestsObject(ctx, "SampleResourceGroup", "swaggerExample", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DppBaseResource = armdataprotection.DppBaseResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards/disableSoftDeleteRequests"), - // ID: to.Ptr("subscriotions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/resourceGuards/swaggerExample/disableSoftDeleteRequests/default"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceGuardsClient().GetDefaultDeleteResourceGuardProxyRequestsObject(ctx, "SampleResourceGroup", "swaggerExample", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DppBaseResource = armdataprotection.DppBaseResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards/deleteResourceGuardProxyRequests"), - // ID: to.Ptr("subscriotions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/resourceGuards/swaggerExample/deleteResourceGuardProxyRequests/default"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceGuardsClient().GetDefaultBackupSecurityPINRequestsObject(ctx, "SampleResourceGroup", "swaggerExample", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DppBaseResource = armdataprotection.DppBaseResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards/getBackupSecurityPINRequests"), - // ID: to.Ptr("subscriotions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/resourceGuards/swaggerExample/getBackupSecurityPINRequests/default"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceGuardsClient().GetDefaultDeleteProtectedItemRequestsObject(ctx, "SampleResourceGroup", "swaggerExample", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DppBaseResource = armdataprotection.DppBaseResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards/deleteProtectedItemRequests"), - // ID: to.Ptr("subscriotions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/resourceGuards/swaggerExample/deleteProtectedItemRequests/default"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceGuardsClient().GetDefaultUpdateProtectionPolicyRequestsObject(ctx, "SampleResourceGroup", "swaggerExample", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DppBaseResource = armdataprotection.DppBaseResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards/updateProtectionPolicyRequests"), - // ID: to.Ptr("subscriotions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/resourceGuards/swaggerExample/updateProtectionPolicyRequests/default"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewResourceGuardsClient().GetDefaultUpdateProtectedItemRequestsObject(ctx, "SampleResourceGroup", "swaggerExample", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DppBaseResource = armdataprotection.DppBaseResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.DataProtection/resourceGuards/updateProtectedItemRequests"), - // ID: to.Ptr("subscriotions/0b352192-dcac-4cc7-992e-a96190ccc68c/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/resourceGuards/swaggerExample/updateProtectedItemRequests/default"), - // } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/response_types.go b/sdk/resourcemanager/dataprotection/armdataprotection/response_types.go index fb6c0b00df93..db525638a3b6 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/response_types.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/response_types.go @@ -3,19 +3,20 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection // BackupInstancesClientAdhocBackupResponse contains the response from method BackupInstancesClient.BeginAdhocBackup. type BackupInstancesClientAdhocBackupResponse struct { + // Operation Job Extended Info OperationJobExtendedInfo } // BackupInstancesClientCreateOrUpdateResponse contains the response from method BackupInstancesClient.BeginCreateOrUpdate. type BackupInstancesClientCreateOrUpdateResponse struct { + // BackupInstance Resource BackupInstanceResource } @@ -26,16 +27,19 @@ type BackupInstancesClientDeleteResponse struct { // BackupInstancesClientGetBackupInstanceOperationResultResponse contains the response from method BackupInstancesClient.GetBackupInstanceOperationResult. type BackupInstancesClientGetBackupInstanceOperationResultResponse struct { + // BackupInstance Resource BackupInstanceResource } // BackupInstancesClientGetResponse contains the response from method BackupInstancesClient.Get. type BackupInstancesClientGetResponse struct { + // BackupInstance Resource BackupInstanceResource } // BackupInstancesClientListResponse contains the response from method BackupInstancesClient.NewListPager. type BackupInstancesClientListResponse struct { + // BackupInstance Resource list response BackupInstanceResourceList } @@ -64,6 +68,12 @@ type BackupInstancesClientSyncBackupInstanceResponse struct { // placeholder for future response values } +// BackupInstancesClientTriggerCrossRegionRestoreResponse contains the response from method BackupInstancesClient.BeginTriggerCrossRegionRestore. +type BackupInstancesClientTriggerCrossRegionRestoreResponse struct { + // Operation Job Extended Info + OperationJobExtendedInfo +} + // BackupInstancesClientTriggerRehydrateResponse contains the response from method BackupInstancesClient.BeginTriggerRehydrate. type BackupInstancesClientTriggerRehydrateResponse struct { // placeholder for future response values @@ -71,21 +81,37 @@ type BackupInstancesClientTriggerRehydrateResponse struct { // BackupInstancesClientTriggerRestoreResponse contains the response from method BackupInstancesClient.BeginTriggerRestore. type BackupInstancesClientTriggerRestoreResponse struct { + // Operation Job Extended Info + OperationJobExtendedInfo +} + +// BackupInstancesClientValidateCrossRegionRestoreResponse contains the response from method BackupInstancesClient.BeginValidateCrossRegionRestore. +type BackupInstancesClientValidateCrossRegionRestoreResponse struct { + // Operation Job Extended Info OperationJobExtendedInfo } // BackupInstancesClientValidateForBackupResponse contains the response from method BackupInstancesClient.BeginValidateForBackup. type BackupInstancesClientValidateForBackupResponse struct { + // Operation Job Extended Info OperationJobExtendedInfo } // BackupInstancesClientValidateForRestoreResponse contains the response from method BackupInstancesClient.BeginValidateForRestore. type BackupInstancesClientValidateForRestoreResponse struct { + // Operation Job Extended Info OperationJobExtendedInfo } +// BackupInstancesExtensionRoutingClientListResponse contains the response from method BackupInstancesExtensionRoutingClient.NewListPager. +type BackupInstancesExtensionRoutingClientListResponse struct { + // BackupInstance Resource list response + BackupInstanceResourceList +} + // BackupPoliciesClientCreateOrUpdateResponse contains the response from method BackupPoliciesClient.CreateOrUpdate. type BackupPoliciesClientCreateOrUpdateResponse struct { + // BaseBackupPolicy resource BaseBackupPolicyResource } @@ -96,17 +122,21 @@ type BackupPoliciesClientDeleteResponse struct { // BackupPoliciesClientGetResponse contains the response from method BackupPoliciesClient.Get. type BackupPoliciesClientGetResponse struct { + // BaseBackupPolicy resource BaseBackupPolicyResource } // BackupPoliciesClientListResponse contains the response from method BackupPoliciesClient.NewListPager. type BackupPoliciesClientListResponse struct { + // List of BaseBackupPolicy resources BaseBackupPolicyResourceList } // BackupVaultOperationResultsClientGetResponse contains the response from method BackupVaultOperationResultsClient.Get. type BackupVaultOperationResultsClientGetResponse struct { + // Backup Vault Resource BackupVaultResource + // AzureAsyncOperation contains the information returned from the Azure-AsyncOperation header response. AzureAsyncOperation *string @@ -119,11 +149,13 @@ type BackupVaultOperationResultsClientGetResponse struct { // BackupVaultsClientCheckNameAvailabilityResponse contains the response from method BackupVaultsClient.CheckNameAvailability. type BackupVaultsClientCheckNameAvailabilityResponse struct { + // CheckNameAvailability Result CheckNameAvailabilityResult } // BackupVaultsClientCreateOrUpdateResponse contains the response from method BackupVaultsClient.BeginCreateOrUpdate. type BackupVaultsClientCreateOrUpdateResponse struct { + // Backup Vault Resource BackupVaultResource } @@ -134,26 +166,31 @@ type BackupVaultsClientDeleteResponse struct { // BackupVaultsClientGetInResourceGroupResponse contains the response from method BackupVaultsClient.NewGetInResourceGroupPager. type BackupVaultsClientGetInResourceGroupResponse struct { + // List of BackupVault resources BackupVaultResourceList } // BackupVaultsClientGetInSubscriptionResponse contains the response from method BackupVaultsClient.NewGetInSubscriptionPager. type BackupVaultsClientGetInSubscriptionResponse struct { + // List of BackupVault resources BackupVaultResourceList } // BackupVaultsClientGetResponse contains the response from method BackupVaultsClient.Get. type BackupVaultsClientGetResponse struct { + // Backup Vault Resource BackupVaultResource } // BackupVaultsClientUpdateResponse contains the response from method BackupVaultsClient.BeginUpdate. type BackupVaultsClientUpdateResponse struct { + // Backup Vault Resource BackupVaultResource } // ClientCheckFeatureSupportResponse contains the response from method Client.CheckFeatureSupport. type ClientCheckFeatureSupportResponse struct { + // Base class for Backup Feature support FeatureValidationResponseBaseClassification } @@ -167,13 +204,27 @@ func (c *ClientCheckFeatureSupportResponse) UnmarshalJSON(data []byte) error { return nil } +// CrossRegionRestoreJobClientGetResponse contains the response from method CrossRegionRestoreJobClient.Get. +type CrossRegionRestoreJobClientGetResponse struct { + // AzureBackup Job Resource Class + AzureBackupJobResource +} + +// CrossRegionRestoreJobsClientListResponse contains the response from method CrossRegionRestoreJobsClient.NewListPager. +type CrossRegionRestoreJobsClientListResponse struct { + // List of AzureBackup Job resources + AzureBackupJobResourceList +} + // DeletedBackupInstancesClientGetResponse contains the response from method DeletedBackupInstancesClient.Get. type DeletedBackupInstancesClientGetResponse struct { + // Deleted Backup Instance DeletedBackupInstanceResource } // DeletedBackupInstancesClientListResponse contains the response from method DeletedBackupInstancesClient.NewListPager. type DeletedBackupInstancesClientListResponse struct { + // List of DeletedBackupInstance resources DeletedBackupInstanceResourceList } @@ -184,6 +235,7 @@ type DeletedBackupInstancesClientUndeleteResponse struct { // DppResourceGuardProxyClientCreateOrUpdateResponse contains the response from method DppResourceGuardProxyClient.CreateOrUpdate. type DppResourceGuardProxyClientCreateOrUpdateResponse struct { + // ResourceGuardProxyBaseResource object, used for response and request bodies for ResourceGuardProxy APIs ResourceGuardProxyBaseResource } @@ -194,16 +246,19 @@ type DppResourceGuardProxyClientDeleteResponse struct { // DppResourceGuardProxyClientGetResponse contains the response from method DppResourceGuardProxyClient.Get. type DppResourceGuardProxyClientGetResponse struct { + // ResourceGuardProxyBaseResource object, used for response and request bodies for ResourceGuardProxy APIs ResourceGuardProxyBaseResource } // DppResourceGuardProxyClientListResponse contains the response from method DppResourceGuardProxyClient.NewListPager. type DppResourceGuardProxyClientListResponse struct { + // List of ResourceGuardProxyBase resources ResourceGuardProxyBaseResourceList } // DppResourceGuardProxyClientUnlockDeleteResponse contains the response from method DppResourceGuardProxyClient.UnlockDelete. type DppResourceGuardProxyClientUnlockDeleteResponse struct { + // Response of Unlock Delete API. UnlockDeleteResponse } @@ -214,22 +269,38 @@ type ExportJobsClientTriggerResponse struct { // ExportJobsOperationResultClientGetResponse contains the response from method ExportJobsOperationResultClient.Get. type ExportJobsOperationResultClientGetResponse struct { + // The result for export jobs containing blob details. ExportJobsResult } +// JobsClientGenerateProgressURLResponse contains the response from method JobsClient.GenerateProgressURL. +type JobsClientGenerateProgressURLResponse struct { + // Job Progress URL class. + AzureBackupJobProgressURL +} + // JobsClientGetResponse contains the response from method JobsClient.Get. type JobsClientGetResponse struct { + // AzureBackup Job Resource Class AzureBackupJobResource } // JobsClientListResponse contains the response from method JobsClient.NewListPager. type JobsClientListResponse struct { + // List of AzureBackup Job resources AzureBackupJobResourceList } +// JobsClientTriggerCancelResponse contains the response from method JobsClient.BeginTriggerCancel. +type JobsClientTriggerCancelResponse struct { + // placeholder for future response values +} + // OperationResultClientGetResponse contains the response from method OperationResultClient.Get. type OperationResultClientGetResponse struct { + // Operation Job Extended Info OperationJobExtendedInfo + // AzureAsyncOperation contains the information returned from the Azure-AsyncOperation header response. AzureAsyncOperation *string @@ -242,31 +313,37 @@ type OperationResultClientGetResponse struct { // OperationStatusBackupVaultContextClientGetResponse contains the response from method OperationStatusBackupVaultContextClient.Get. type OperationStatusBackupVaultContextClientGetResponse struct { + // Operation Resource OperationResource } // OperationStatusClientGetResponse contains the response from method OperationStatusClient.Get. type OperationStatusClientGetResponse struct { + // Operation Resource OperationResource } // OperationStatusResourceGroupContextClientGetResponse contains the response from method OperationStatusResourceGroupContextClient.Get. type OperationStatusResourceGroupContextClientGetResponse struct { + // Operation Resource OperationResource } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // Operations List response which contains list of available APIs. ClientDiscoveryResponse } // RecoveryPointsClientGetResponse contains the response from method RecoveryPointsClient.Get. type RecoveryPointsClientGetResponse struct { + // Azure backup recoveryPoint resource AzureBackupRecoveryPointResource } // RecoveryPointsClientListResponse contains the response from method RecoveryPointsClient.NewListPager. type RecoveryPointsClientListResponse struct { + // Azure backup recoveryPoint resource list AzureBackupRecoveryPointResourceList } @@ -277,61 +354,73 @@ type ResourceGuardsClientDeleteResponse struct { // ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse contains the response from method ResourceGuardsClient.NewGetBackupSecurityPINRequestsObjectsPager. type ResourceGuardsClientGetBackupSecurityPINRequestsObjectsResponse struct { + // Base for all lists of V2 resources. DppBaseResourceList } // ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResponse contains the response from method ResourceGuardsClient.GetDefaultBackupSecurityPINRequestsObject. type ResourceGuardsClientGetDefaultBackupSecurityPINRequestsObjectResponse struct { + // Base resource under Microsoft.DataProtection provider namespace DppBaseResource } // ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResponse contains the response from method ResourceGuardsClient.GetDefaultDeleteProtectedItemRequestsObject. type ResourceGuardsClientGetDefaultDeleteProtectedItemRequestsObjectResponse struct { + // Base resource under Microsoft.DataProtection provider namespace DppBaseResource } // ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResponse contains the response from method ResourceGuardsClient.GetDefaultDeleteResourceGuardProxyRequestsObject. type ResourceGuardsClientGetDefaultDeleteResourceGuardProxyRequestsObjectResponse struct { + // Base resource under Microsoft.DataProtection provider namespace DppBaseResource } // ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResponse contains the response from method ResourceGuardsClient.GetDefaultDisableSoftDeleteRequestsObject. type ResourceGuardsClientGetDefaultDisableSoftDeleteRequestsObjectResponse struct { + // Base resource under Microsoft.DataProtection provider namespace DppBaseResource } // ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResponse contains the response from method ResourceGuardsClient.GetDefaultUpdateProtectedItemRequestsObject. type ResourceGuardsClientGetDefaultUpdateProtectedItemRequestsObjectResponse struct { + // Base resource under Microsoft.DataProtection provider namespace DppBaseResource } // ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse contains the response from method ResourceGuardsClient.GetDefaultUpdateProtectionPolicyRequestsObject. type ResourceGuardsClientGetDefaultUpdateProtectionPolicyRequestsObjectResponse struct { + // Base resource under Microsoft.DataProtection provider namespace DppBaseResource } // ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse contains the response from method ResourceGuardsClient.NewGetDeleteProtectedItemRequestsObjectsPager. type ResourceGuardsClientGetDeleteProtectedItemRequestsObjectsResponse struct { + // Base for all lists of V2 resources. DppBaseResourceList } // ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse contains the response from method ResourceGuardsClient.NewGetDeleteResourceGuardProxyRequestsObjectsPager. type ResourceGuardsClientGetDeleteResourceGuardProxyRequestsObjectsResponse struct { + // Base for all lists of V2 resources. DppBaseResourceList } // ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse contains the response from method ResourceGuardsClient.NewGetDisableSoftDeleteRequestsObjectsPager. type ResourceGuardsClientGetDisableSoftDeleteRequestsObjectsResponse struct { + // Base for all lists of V2 resources. DppBaseResourceList } // ResourceGuardsClientGetResourcesInResourceGroupResponse contains the response from method ResourceGuardsClient.NewGetResourcesInResourceGroupPager. type ResourceGuardsClientGetResourcesInResourceGroupResponse struct { + // List of ResourceGuard resources ResourceGuardResourceList } // ResourceGuardsClientGetResourcesInSubscriptionResponse contains the response from method ResourceGuardsClient.NewGetResourcesInSubscriptionPager. type ResourceGuardsClientGetResourcesInSubscriptionResponse struct { + // List of ResourceGuard resources ResourceGuardResourceList } @@ -342,11 +431,13 @@ type ResourceGuardsClientGetResponse struct { // ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse contains the response from method ResourceGuardsClient.NewGetUpdateProtectedItemRequestsObjectsPager. type ResourceGuardsClientGetUpdateProtectedItemRequestsObjectsResponse struct { + // Base for all lists of V2 resources. DppBaseResourceList } // ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse contains the response from method ResourceGuardsClient.NewGetUpdateProtectionPolicyRequestsObjectsPager. type ResourceGuardsClientGetUpdateProtectionPolicyRequestsObjectsResponse struct { + // Base for all lists of V2 resources. DppBaseResourceList } @@ -362,5 +453,12 @@ type ResourceGuardsClientPutResponse struct { // RestorableTimeRangesClientFindResponse contains the response from method RestorableTimeRangesClient.Find. type RestorableTimeRangesClientFindResponse struct { + // List Restore Ranges Response AzureBackupFindRestorableTimeRangesResponseResource } + +// SecondaryRPsClientFetchResponse contains the response from method SecondaryRPsClient.NewFetchPager. +type SecondaryRPsClientFetchResponse struct { + // Azure backup recoveryPoint resource list + AzureBackupRecoveryPointResourceList +} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client.go index cce7f9553b08..8ad87dce1e72 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection @@ -47,7 +46,7 @@ func NewRestorableTimeRangesClient(subscriptionID string, credential azcore.Toke // Find - // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2023-06-01-preview // - 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. @@ -55,18 +54,21 @@ func NewRestorableTimeRangesClient(subscriptionID string, credential azcore.Toke // - options - RestorableTimeRangesClientFindOptions contains the optional parameters for the RestorableTimeRangesClient.Find // method. func (client *RestorableTimeRangesClient) Find(ctx context.Context, resourceGroupName string, vaultName string, backupInstanceName string, parameters AzureBackupFindRestorableTimeRangesRequest, options *RestorableTimeRangesClientFindOptions) (RestorableTimeRangesClientFindResponse, error) { + var err error req, err := client.findCreateRequest(ctx, resourceGroupName, vaultName, backupInstanceName, parameters, options) if err != nil { return RestorableTimeRangesClientFindResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RestorableTimeRangesClientFindResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RestorableTimeRangesClientFindResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RestorableTimeRangesClientFindResponse{}, err } - return client.findHandleResponse(resp) + resp, err := client.findHandleResponse(httpResp) + return resp, err } // findCreateRequest creates the Find request. @@ -90,10 +92,13 @@ func (client *RestorableTimeRangesClient) findCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // findHandleResponse handles the Find response. diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client_example_test.go b/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client_example_test.go deleted file mode 100644 index 19f3bad3a09a..000000000000 --- a/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client_example_test.go +++ /dev/null @@ -1,56 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armdataprotection_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dataprotection/armdataprotection/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2023-05-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() - clientFactory, err := armdataprotection.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRestorableTimeRangesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AzureBackupFindRestorableTimeRangesResponseResource = armdataprotection.AzureBackupFindRestorableTimeRangesResponseResource{ - // Type: to.Ptr("Microsoft.DataProtection/backupVaults/backupInstances/findRestorableTimeRanges"), - // ID: to.Ptr("zblobbackuptestsa58"), - // Properties: &armdataprotection.AzureBackupFindRestorableTimeRangesResponse{ - // ObjectType: to.Ptr("AzureBackupFindRestorableTimeRangesResponse"), - // RestorableTimeRanges: []*armdataprotection.RestorableTimeRange{ - // { - // EndTime: to.Ptr("2021-02-24T00:35:17.0000000Z"), - // ObjectType: to.Ptr("RestorableTimeRange"), - // StartTime: to.Ptr("2021-02-23T18:33:51.6349708Z"), - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/secondaryrps_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/secondaryrps_client.go new file mode 100644 index 000000000000..eaabd332d555 --- /dev/null +++ b/sdk/resourcemanager/dataprotection/armdataprotection/secondaryrps_client.go @@ -0,0 +1,120 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armdataprotection + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SecondaryRPsClient contains the methods for the SecondaryRPs group. +// Don't use this type directly, use NewSecondaryRPsClient() instead. +type SecondaryRPsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSecondaryRPsClient creates a new instance of SecondaryRPsClient 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 NewSecondaryRPsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecondaryRPsClient, error) { + cl, err := arm.NewClient(moduleName+".SecondaryRPsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SecondaryRPsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewFetchPager - Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for Cross Region +// Restore. +// +// Generated from API version 2023-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parameters - Request body for operation +// - options - SecondaryRPsClientFetchOptions contains the optional parameters for the SecondaryRPsClient.NewFetchPager method. +func (client *SecondaryRPsClient) NewFetchPager(resourceGroupName string, location string, parameters FetchSecondaryRPsRequestParameters, options *SecondaryRPsClientFetchOptions) *runtime.Pager[SecondaryRPsClientFetchResponse] { + return runtime.NewPager(runtime.PagingHandler[SecondaryRPsClientFetchResponse]{ + More: func(page SecondaryRPsClientFetchResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SecondaryRPsClientFetchResponse) (SecondaryRPsClientFetchResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.fetchCreateRequest(ctx, resourceGroupName, location, parameters, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SecondaryRPsClientFetchResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecondaryRPsClientFetchResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecondaryRPsClientFetchResponse{}, runtime.NewResponseError(resp) + } + return client.fetchHandleResponse(resp) + }, + }) +} + +// fetchCreateRequest creates the Fetch request. +func (client *SecondaryRPsClient) fetchCreateRequest(ctx context.Context, resourceGroupName string, location string, parameters FetchSecondaryRPsRequestParameters, options *SecondaryRPsClientFetchOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchSecondaryRecoveryPoints" + 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 location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// fetchHandleResponse handles the Fetch response. +func (client *SecondaryRPsClient) fetchHandleResponse(resp *http.Response) (SecondaryRPsClientFetchResponse, error) { + result := SecondaryRPsClientFetchResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AzureBackupRecoveryPointResourceList); err != nil { + return SecondaryRPsClientFetchResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/time_rfc3339.go b/sdk/resourcemanager/dataprotection/armdataprotection/time_rfc3339.go index 8ee2848040f9..7794f8dface9 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/time_rfc3339.go +++ b/sdk/resourcemanager/dataprotection/armdataprotection/time_rfc3339.go @@ -3,9 +3,8 @@ // 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. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armdataprotection