diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md b/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md index 2ef316a274c9..b3ac6249f4ef 100644 --- a/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md +++ b/sdk/resourcemanager/dataprotection/armdataprotection/CHANGELOG.md @@ -1,5 +1,17 @@ # Release History +## 3.0.0 (2023-08-18) +### Breaking Changes + +- Type of `BaseResourceProperties.ObjectType` has been changed from `*string` to `*ObjectType` + +### Features Added + +- New enum type `ObjectType` with values `ObjectTypeDefaultResourceProperties` +- New function `*DefaultResourceProperties.GetBaseResourceProperties() *BaseResourceProperties` +- New struct `DefaultResourceProperties` + + ## 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..7bf0ba8ecf01 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 ``` \ 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..0c6741fde1cd 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 @@ -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) } @@ -71,18 +73,20 @@ func (client *BackupInstancesClient) BeginAdhocBackup(ctx context.Context, resou // // Generated from API version 2023-05-01 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. @@ -109,7 +113,10 @@ func (client *BackupInstancesClient) adhocBackupCreateRequest(ctx context.Contex reqQP.Set("api-version", "2023-05-01") 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 @@ -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) } @@ -139,18 +147,20 @@ func (client *BackupInstancesClient) BeginCreateOrUpdate(ctx context.Context, re // // Generated from API version 2023-05-01 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. @@ -177,7 +187,10 @@ func (client *BackupInstancesClient) createOrUpdateCreateRequest(ctx context.Con reqQP.Set("api-version", "2023-05-01") 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 @@ -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) } @@ -206,18 +220,20 @@ func (client *BackupInstancesClient) BeginDelete(ctx context.Context, resourceGr // // Generated from API version 2023-05-01 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. @@ -256,18 +272,21 @@ func (client *BackupInstancesClient) deleteCreateRequest(ctx context.Context, re // - 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. @@ -316,18 +335,21 @@ func (client *BackupInstancesClient) getHandleResponse(resp *http.Response) (Bac // - 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. @@ -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) } @@ -463,18 +486,20 @@ func (client *BackupInstancesClient) BeginResumeBackups(ctx context.Context, res // // Generated from API version 2023-05-01 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. @@ -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) } @@ -530,18 +556,20 @@ func (client *BackupInstancesClient) BeginResumeProtection(ctx context.Context, // // Generated from API version 2023-05-01 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. @@ -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) } @@ -597,18 +626,20 @@ func (client *BackupInstancesClient) BeginStopProtection(ctx context.Context, re // // Generated from API version 2023-05-01 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. @@ -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) } @@ -666,18 +698,20 @@ func (client *BackupInstancesClient) BeginSuspendBackups(ctx context.Context, re // // Generated from API version 2023-05-01 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. @@ -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) } @@ -736,18 +771,20 @@ func (client *BackupInstancesClient) BeginSyncBackupInstance(ctx context.Context // // Generated from API version 2023-05-01 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. @@ -774,7 +811,10 @@ func (client *BackupInstancesClient) syncBackupInstanceCreateRequest(ctx context reqQP.Set("api-version", "2023-05-01") 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 @@ -793,7 +833,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) } @@ -804,18 +845,20 @@ func (client *BackupInstancesClient) BeginTriggerRehydrate(ctx context.Context, // // Generated from API version 2023-05-01 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. @@ -842,7 +885,10 @@ func (client *BackupInstancesClient) triggerRehydrateCreateRequest(ctx context.C reqQP.Set("api-version", "2023-05-01") 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 @@ -861,7 +907,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) } @@ -872,18 +921,20 @@ func (client *BackupInstancesClient) BeginTriggerRestore(ctx context.Context, re // // Generated from API version 2023-05-01 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. @@ -910,7 +961,10 @@ func (client *BackupInstancesClient) triggerRestoreCreateRequest(ctx context.Con reqQP.Set("api-version", "2023-05-01") 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 @@ -928,7 +982,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) } @@ -939,18 +996,20 @@ func (client *BackupInstancesClient) BeginValidateForBackup(ctx context.Context, // // Generated from API version 2023-05-01 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. @@ -973,7 +1032,10 @@ func (client *BackupInstancesClient) validateForBackupCreateRequest(ctx context. reqQP.Set("api-version", "2023-05-01") 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 @@ -992,7 +1054,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) } @@ -1003,18 +1068,20 @@ func (client *BackupInstancesClient) BeginValidateForRestore(ctx context.Context // // Generated from API version 2023-05-01 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. @@ -1041,5 +1108,8 @@ func (client *BackupInstancesClient) validateForRestoreCreateRequest(ctx context reqQP.Set("api-version", "2023-05-01") 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/backuppolicies_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/backuppolicies_client.go index 5321bf7d1ee7..8c13b6b0646b 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 @@ -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. @@ -93,7 +95,10 @@ func (client *BackupPoliciesClient) createOrUpdateCreateRequest(ctx context.Cont reqQP.Set("api-version", "2023-05-01") 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. @@ -113,16 +118,18 @@ func (client *BackupPoliciesClient) createOrUpdateHandleResponse(resp *http.Resp // - 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 } @@ -162,18 +169,21 @@ func (client *BackupPoliciesClient) deleteCreateRequest(ctx context.Context, res // - 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. 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..2d083b598f78 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 @@ -54,18 +53,21 @@ func NewBackupVaultOperationResultsClient(subscriptionID string, credential azco // - 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. @@ -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..98cfe7240e52 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 @@ -54,18 +53,21 @@ func NewBackupVaultsClient(subscriptionID string, credential azcore.TokenCredent // - 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. @@ -88,7 +90,10 @@ func (client *BackupVaultsClient) checkNameAvailabilityCreateRequest(ctx context reqQP.Set("api-version", "2023-05-01") 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. @@ -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) } @@ -126,18 +132,20 @@ func (client *BackupVaultsClient) BeginCreateOrUpdate(ctx context.Context, resou // // Generated from API version 2023-05-01 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. @@ -160,7 +168,10 @@ func (client *BackupVaultsClient) createOrUpdateCreateRequest(ctx context.Contex reqQP.Set("api-version", "2023-05-01") 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. @@ -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) } @@ -188,18 +200,20 @@ func (client *BackupVaultsClient) BeginDelete(ctx context.Context, resourceGroup // // Generated from API version 2023-05-01 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. @@ -233,18 +247,21 @@ func (client *BackupVaultsClient) deleteCreateRequest(ctx context.Context, resou // - 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. @@ -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) } @@ -424,18 +442,20 @@ func (client *BackupVaultsClient) BeginUpdate(ctx context.Context, resourceGroup // // Generated from API version 2023-05-01 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. @@ -458,5 +478,8 @@ func (client *BackupVaultsClient) updateCreateRequest(ctx context.Context, resou reqQP.Set("api-version", "2023-05-01") 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..10a8c8ca218a 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 @@ -51,18 +50,21 @@ func NewClient(subscriptionID string, credential azcore.TokenCredential, options // - 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. @@ -81,7 +83,10 @@ func (client *Client) checkFeatureSupportCreateRequest(ctx context.Context, loca reqQP.Set("api-version", "2023-05-01") 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..e97c5d15768c 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,83 +37,83 @@ 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) NewBackupPoliciesClient() *BackupPoliciesClient { + subClient, _ := NewBackupPoliciesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationStatusClient() *OperationStatusClient { - subClient, _ := NewOperationStatusClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewBackupVaultOperationResultsClient() *BackupVaultOperationResultsClient { + subClient, _ := NewBackupVaultOperationResultsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationStatusBackupVaultContextClient() *OperationStatusBackupVaultContextClient { - subClient, _ := NewOperationStatusBackupVaultContextClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewBackupVaultsClient() *BackupVaultsClient { + subClient, _ := NewBackupVaultsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationStatusResourceGroupContextClient() *OperationStatusResourceGroupContextClient { - subClient, _ := NewOperationStatusResourceGroupContextClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewClient() *Client { + subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewBackupVaultOperationResultsClient() *BackupVaultOperationResultsClient { - subClient, _ := NewBackupVaultOperationResultsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDeletedBackupInstancesClient() *DeletedBackupInstancesClient { + subClient, _ := NewDeletedBackupInstancesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewClient() *Client { - subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDppResourceGuardProxyClient() *DppResourceGuardProxyClient { + subClient, _ := NewDppResourceGuardProxyClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewExportJobsClient() *ExportJobsClient { + subClient, _ := NewExportJobsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewBackupPoliciesClient() *BackupPoliciesClient { - subClient, _ := NewBackupPoliciesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewExportJobsOperationResultClient() *ExportJobsOperationResultClient { + subClient, _ := NewExportJobsOperationResultClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewBackupInstancesClient() *BackupInstancesClient { - subClient, _ := NewBackupInstancesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewJobsClient() *JobsClient { + subClient, _ := NewJobsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRecoveryPointsClient() *RecoveryPointsClient { - subClient, _ := NewRecoveryPointsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationResultClient() *OperationResultClient { + subClient, _ := NewOperationResultClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewJobsClient() *JobsClient { - subClient, _ := NewJobsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationStatusBackupVaultContextClient() *OperationStatusBackupVaultContextClient { + subClient, _ := NewOperationStatusBackupVaultContextClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRestorableTimeRangesClient() *RestorableTimeRangesClient { - subClient, _ := NewRestorableTimeRangesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationStatusClient() *OperationStatusClient { + subClient, _ := NewOperationStatusClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewExportJobsClient() *ExportJobsClient { - subClient, _ := NewExportJobsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationStatusResourceGroupContextClient() *OperationStatusResourceGroupContextClient { + subClient, _ := NewOperationStatusResourceGroupContextClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewExportJobsOperationResultClient() *ExportJobsOperationResultClient { - subClient, _ := NewExportJobsOperationResultClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewDeletedBackupInstancesClient() *DeletedBackupInstancesClient { - subClient, _ := NewDeletedBackupInstancesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRecoveryPointsClient() *RecoveryPointsClient { + subClient, _ := NewRecoveryPointsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -123,7 +122,7 @@ 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 } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/constants.go b/sdk/resourcemanager/dataprotection/armdataprotection/constants.go index 7aa33104d47a..ad21d0c58b48 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" ) type AbsoluteMarker string @@ -293,6 +292,20 @@ func PossibleMonthValues() []Month { } } +// ObjectType - Type of the specific object - used for deserializing +type ObjectType string + +const ( + ObjectTypeDefaultResourceProperties ObjectType = "DefaultResourceProperties" +) + +// PossibleObjectTypeValues returns the possible values for the ObjectType const type. +func PossibleObjectTypeValues() []ObjectType { + return []ObjectType{ + ObjectTypeDefaultResourceProperties, + } +} + // PersistentVolumeRestoreMode - Gets or sets the PV (Persistent Volume) Restore Mode property. This property sets whether // volumes needs to be restored. type PersistentVolumeRestoreMode string diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/deletedbackupinstances_client.go index 49112d51b22d..090ede7b9ee0 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 @@ -54,18 +53,21 @@ func NewDeletedBackupInstancesClient(subscriptionID string, credential azcore.To // - 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. @@ -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) } @@ -197,18 +200,20 @@ func (client *DeletedBackupInstancesClient) BeginUndelete(ctx context.Context, r // // Generated from API version 2023-05-01 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. 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..b1487318e010 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 @@ -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. @@ -93,7 +95,10 @@ func (client *DppResourceGuardProxyClient) createOrUpdateCreateRequest(ctx conte reqQP.Set("api-version", "2023-05-01") 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. @@ -115,16 +120,18 @@ func (client *DppResourceGuardProxyClient) createOrUpdateHandleResponse(resp *ht // - 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 } @@ -166,18 +173,21 @@ func (client *DppResourceGuardProxyClient) deleteCreateRequest(ctx context.Conte // - 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. @@ -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. @@ -332,7 +345,10 @@ func (client *DppResourceGuardProxyClient) unlockDeleteCreateRequest(ctx context reqQP.Set("api-version", "2023-05-01") 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..bbfe592a1882 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 @@ -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) } @@ -70,18 +70,20 @@ func (client *ExportJobsClient) BeginTrigger(ctx context.Context, resourceGroupN // // Generated from API version 2023-05-01 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. 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..9286457adc70 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 @@ -56,18 +55,21 @@ func NewExportJobsOperationResultClient(subscriptionID string, credential azcore // - 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. 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..eb106a30fbe8 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 @@ -53,18 +52,21 @@ func NewJobsClient(subscriptionID string, credential azcore.TokenCredential, opt // - 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. 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..fc5d42cf329c 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 @@ -297,15 +287,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 +296,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 +326,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 +385,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 +405,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 +459,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 +525,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 +551,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 +560,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 +640,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 +649,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 +708,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 +747,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 +786,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 +798,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 *ObjectType } // GetBaseResourceProperties implements the BaseResourcePropertiesClassification interface for type BaseResourceProperties. @@ -1105,11 +844,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 +923,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 @@ -1243,15 +968,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 +1045,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 *ObjectType +} + +// GetBaseResourceProperties implements the BaseResourcePropertiesClassification interface for type DefaultResourceProperties. +func (d *DefaultResourceProperties) GetBaseResourceProperties() *BaseResourceProperties { + return &BaseResourceProperties{ + ObjectType: d.ObjectType, + } } // DeleteOption - Delete Option @@ -1419,24 +1139,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 +1246,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 +1324,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 +1366,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 +1396,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 @@ -1802,16 +1446,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 @@ -1919,16 +1553,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 @@ -2066,15 +1690,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 +1739,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 +1835,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 +1946,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 +1973,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 +2032,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 +2262,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 diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/models_serde.go b/sdk/resourcemanager/dataprotection/armdataprotection/models_serde.go index 5d7ded859860..d48d91d8ce7b 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 @@ -2395,6 +2394,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"] = ObjectTypeDefaultResourceProperties + 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) diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/operationresult_client.go index 9ffe5783e26b..afa380330f3e 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 @@ -51,18 +50,21 @@ func NewOperationResultClient(subscriptionID string, credential azcore.TokenCred // Generated from API version 2023-05-01 // - options - OperationResultClientGetOptions contains the optional parameters for the OperationResultClient.Get method. func (client *OperationResultClient) Get(ctx context.Context, operationID string, location string, options *OperationResultClientGetOptions) (OperationResultClientGetResponse, error) { + 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. @@ -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..3edf76001915 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 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..12fa4c6bc8fb 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 @@ -50,18 +49,21 @@ func NewOperationStatusClient(subscriptionID string, credential azcore.TokenCred // Generated from API version 2023-05-01 // - options - OperationStatusClientGetOptions contains the optional parameters for the OperationStatusClient.Get method. func (client *OperationStatusClient) Get(ctx context.Context, location string, operationID string, options *OperationStatusClientGetOptions) (OperationStatusClientGetResponse, error) { + 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. 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..19426dd8b6ff 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 @@ -53,18 +52,21 @@ func NewOperationStatusBackupVaultContextClient(subscriptionID string, credentia // - 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. 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..b31ebbb01013 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 @@ -52,18 +51,21 @@ func NewOperationStatusResourceGroupContextClient(subscriptionID string, credent // - 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. 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..d54123a15734 --- /dev/null +++ b/sdk/resourcemanager/dataprotection/armdataprotection/options.go @@ -0,0 +1,400 @@ +//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 +} + +// 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 +} + +// 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 +} + +// 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 +} + +// 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 +} diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/polymorphic_helpers.go b/sdk/resourcemanager/dataprotection/armdataprotection/polymorphic_helpers.go index 91bb0473a888..a05f1b07d14d 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(ObjectTypeDefaultResourceProperties): + 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..34666f8871c8 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 @@ -53,18 +52,21 @@ func NewRecoveryPointsClient(subscriptionID string, credential azcore.TokenCrede // - 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. 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..593f57b6c32d 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 @@ -52,16 +51,18 @@ func NewResourceGuardsClient(subscriptionID string, credential azcore.TokenCrede // - 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 } @@ -97,18 +98,21 @@ func (client *ResourceGuardsClient) deleteCreateRequest(ctx context.Context, res // - 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. @@ -219,18 +223,21 @@ func (client *ResourceGuardsClient) getBackupSecurityPINRequestsObjectsHandleRes // - 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. @@ -278,18 +285,21 @@ func (client *ResourceGuardsClient) getDefaultBackupSecurityPINRequestsObjectHan // - 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. @@ -337,18 +347,21 @@ func (client *ResourceGuardsClient) getDefaultDeleteProtectedItemRequestsObjectH // - 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. @@ -396,18 +409,21 @@ func (client *ResourceGuardsClient) getDefaultDeleteResourceGuardProxyRequestsOb // - 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. @@ -455,18 +471,21 @@ func (client *ResourceGuardsClient) getDefaultDisableSoftDeleteRequestsObjectHan // - 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. @@ -514,18 +533,21 @@ func (client *ResourceGuardsClient) getDefaultUpdateProtectedItemRequestsObjectH // - 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. @@ -1027,18 +1049,21 @@ func (client *ResourceGuardsClient) getUpdateProtectionPolicyRequestsObjectsHand // - 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. @@ -1061,7 +1086,10 @@ func (client *ResourceGuardsClient) patchCreateRequest(ctx context.Context, reso reqQP.Set("api-version", "2023-05-01") 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. @@ -1082,18 +1110,21 @@ func (client *ResourceGuardsClient) patchHandleResponse(resp *http.Response) (Re // - 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. @@ -1116,7 +1147,10 @@ func (client *ResourceGuardsClient) putCreateRequest(ctx context.Context, resour reqQP.Set("api-version", "2023-05-01") 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..6b9ae0c3e2f5 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 } @@ -71,21 +75,25 @@ type BackupInstancesClientTriggerRehydrateResponse struct { // BackupInstancesClientTriggerRestoreResponse contains the response from method BackupInstancesClient.BeginTriggerRestore. type BackupInstancesClientTriggerRestoreResponse 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 } // BackupPoliciesClientCreateOrUpdateResponse contains the response from method BackupPoliciesClient.CreateOrUpdate. type BackupPoliciesClientCreateOrUpdateResponse struct { + // BaseBackupPolicy resource BaseBackupPolicyResource } @@ -96,17 +104,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 +131,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 +148,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 } @@ -169,11 +188,13 @@ func (c *ClientCheckFeatureSupportResponse) UnmarshalJSON(data []byte) error { // 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 +205,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 +216,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 +239,27 @@ type ExportJobsClientTriggerResponse struct { // ExportJobsOperationResultClientGetResponse contains the response from method ExportJobsOperationResultClient.Get. type ExportJobsOperationResultClientGetResponse struct { + // The result for export jobs containing blob details. ExportJobsResult } // 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 } // 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 +272,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 +313,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 +390,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 +412,6 @@ type ResourceGuardsClientPutResponse struct { // RestorableTimeRangesClientFindResponse contains the response from method RestorableTimeRangesClient.Find. type RestorableTimeRangesClientFindResponse struct { + // List Restore Ranges Response AzureBackupFindRestorableTimeRangesResponseResource } diff --git a/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client.go b/sdk/resourcemanager/dataprotection/armdataprotection/restorabletimeranges_client.go index cce7f9553b08..9df6daea5a39 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 @@ -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. @@ -93,7 +95,10 @@ func (client *RestorableTimeRangesClient) findCreateRequest(ctx context.Context, reqQP.Set("api-version", "2023-05-01") 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/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