From dd5b533b3d869e70780a4e2b6a491b737a79f361 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 22 Nov 2023 08:15:17 +0000 Subject: [PATCH] CodeGen from PR 26491 in Azure/azure-rest-api-specs Merge 1fead771fdafa41ccaa1e43750bab608b951ca80 into 7ae8d80917d262746790f86c98c5191bd0ce8eff --- common/config/rush/pnpm-lock.yaml | 14 +- .../arm-dataprotection/CHANGELOG.md | 63 ++- .../arm-dataprotection/_meta.json | 8 +- .../arm-dataprotection/package.json | 26 +- .../review/arm-dataprotection.api.md | 216 +++++++- .../src/dataProtectionClient.ts | 20 +- .../arm-dataprotection/src/models/index.ts | 343 ++++++++++-- .../arm-dataprotection/src/models/mappers.ts | 493 +++++++++++++++++- .../src/models/parameters.ts | 62 ++- .../src/operations/backupInstances.ts | 284 +++++++++- .../src/operations/dppResourceGuardProxy.ts | 4 +- .../operations/fetchCrossRegionRestoreJob.ts | 78 +++ .../operations/fetchCrossRegionRestoreJobs.ts | 220 ++++++++ .../fetchSecondaryRecoveryPoints.ts | 226 ++++++++ .../src/operations/index.ts | 3 + .../src/operations/resourceGuards.ts | 4 +- .../src/operations/restorableTimeRanges.ts | 2 +- .../operationsInterfaces/backupInstances.ts | 68 +++ .../fetchCrossRegionRestoreJob.ts | 30 ++ .../fetchCrossRegionRestoreJobs.ts | 32 ++ .../fetchSecondaryRecoveryPoints.ts | 33 ++ .../src/operationsInterfaces/index.ts | 3 + .../arm-dataprotection/test/sampleTest.ts | 43 ++ .../arm-dataprotection/tsconfig.json | 10 +- 24 files changed, 2153 insertions(+), 132 deletions(-) create mode 100644 sdk/dataprotection/arm-dataprotection/src/operations/fetchCrossRegionRestoreJob.ts create mode 100644 sdk/dataprotection/arm-dataprotection/src/operations/fetchCrossRegionRestoreJobs.ts create mode 100644 sdk/dataprotection/arm-dataprotection/src/operations/fetchSecondaryRecoveryPoints.ts create mode 100644 sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/fetchCrossRegionRestoreJob.ts create mode 100644 sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/fetchCrossRegionRestoreJobs.ts create mode 100644 sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/fetchSecondaryRecoveryPoints.ts create mode 100644 sdk/dataprotection/arm-dataprotection/test/sampleTest.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 198667abb535..2f8ece82812f 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -4440,7 +4440,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.4.0-dev.20231120 + typescript: 5.4.0-dev.20231122 dev: false /downlevel-dts@0.11.0: @@ -4449,7 +4449,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.4.0-dev.20231120 + typescript: 5.4.0-dev.20231122 dev: false /eastasianwidth@0.2.0: @@ -9155,8 +9155,8 @@ packages: hasBin: true dev: false - /typescript@5.4.0-dev.20231120: - resolution: {integrity: sha512-MG4Zg5HXb8bnvGdZrMeLBekqbCjHjaMPewXh3wVrNgTF+toQ4BrdhXnYiqMU0pLLxcsxRSMPB5MzB7YHgr67Cg==} + /typescript@5.4.0-dev.20231122: + resolution: {integrity: sha512-jEdb2OJDseS3Vi8dg4ARi3ZDqwopyxJP9qsIFawXzTrVSfcIj4WGbBvDx4MIJuwFqGhkJ4G2cJESi3+eN0Rydw==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -12048,20 +12048,22 @@ packages: dev: false file:projects/arm-dataprotection.tgz: - resolution: {integrity: sha512-fbX3LFgjnpFsuNWE875EHY/b3hwwL7EzqT/CGl/ijIFhhtr5kCRpgrovJGaceVXjLrE8H2g90M3ZPJ30FHk/Mw==, tarball: file:projects/arm-dataprotection.tgz} + resolution: {integrity: sha512-edAE2wjDB1dv5DiwnM0jZrVFfJjrlOvSHU3FbfdvYoQkyHjcdllZekz5lcxBlSZPS9lxPH/3bdAn3f+Auimxvw==, tarball: file:projects/arm-dataprotection.tgz} name: '@rush-temp/arm-dataprotection' version: 0.0.0 dependencies: '@azure/identity': 3.4.1 '@microsoft/api-extractor': 7.38.3(@types/node@18.18.10) '@types/chai': 4.3.10 + '@types/mocha': 10.0.4 '@types/node': 18.18.10 chai: 4.3.10 cross-env: 7.0.3 dotenv: 16.3.1 + esm: 3.2.25 mkdirp: 2.1.6 mocha: 10.2.0 - rimraf: 3.0.2 + rimraf: 5.0.5 ts-node: 10.9.1(@types/node@18.18.10)(typescript@5.2.2) tslib: 2.6.2 typescript: 5.2.2 diff --git a/sdk/dataprotection/arm-dataprotection/CHANGELOG.md b/sdk/dataprotection/arm-dataprotection/CHANGELOG.md index 9b9de0b5b311..876c2c61fed9 100644 --- a/sdk/dataprotection/arm-dataprotection/CHANGELOG.md +++ b/sdk/dataprotection/arm-dataprotection/CHANGELOG.md @@ -1,15 +1,60 @@ # Release History + +## 2.0.0 (2023-11-22) + +**Features** -## 1.2.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed + - Added operation group FetchCrossRegionRestoreJob + - Added operation group FetchCrossRegionRestoreJobs + - Added operation group FetchSecondaryRecoveryPoints + - Added operation BackupInstances.beginTriggerCrossRegionRestore + - Added operation BackupInstances.beginTriggerCrossRegionRestoreAndWait + - Added operation BackupInstances.beginValidateCrossRegionRestore + - Added operation BackupInstances.beginValidateCrossRegionRestoreAndWait + - Added Interface BackupInstancesTriggerCrossRegionRestoreHeaders + - Added Interface BackupInstancesTriggerCrossRegionRestoreOptionalParams + - Added Interface BackupInstancesValidateCrossRegionRestoreHeaders + - Added Interface BackupInstancesValidateCrossRegionRestoreOptionalParams + - Added Interface CrossRegionRestoreDetails + - Added Interface CrossRegionRestoreJobRequest + - Added Interface CrossRegionRestoreJobsRequest + - Added Interface CrossRegionRestoreRequestObject + - Added Interface DefaultResourceProperties + - Added Interface ErrorDetail + - Added Interface ErrorResponse + - Added Interface FetchCrossRegionRestoreJobGetOptionalParams + - Added Interface FetchCrossRegionRestoreJobsListNextOptionalParams + - Added Interface FetchCrossRegionRestoreJobsListOptionalParams + - Added Interface FetchSecondaryRecoveryPointsListNextOptionalParams + - Added Interface FetchSecondaryRecoveryPointsListOptionalParams + - Added Interface FetchSecondaryRPsRequestParameters + - Added Interface KubernetesClusterVaultTierRestoreCriteria + - Added Interface UserFacingWarningDetail + - Added Interface ValidateCrossRegionRestoreRequestObject + - Added Type Alias BackupInstancesTriggerCrossRegionRestoreResponse + - Added Type Alias BackupInstancesValidateCrossRegionRestoreResponse + - Added Type Alias BaseResourcePropertiesUnion + - Added Type Alias FetchCrossRegionRestoreJobGetResponse + - Added Type Alias FetchCrossRegionRestoreJobsListNextResponse + - Added Type Alias FetchCrossRegionRestoreJobsListResponse + - Added Type Alias FetchSecondaryRecoveryPointsListNextResponse + - Added Type Alias FetchSecondaryRecoveryPointsListResponse + - Added Type Alias RecoveryPointCompletionState + - Added Type Alias ResourcePropertiesObjectType + - Interface AzureBackupDiscreteRecoveryPoint has a new optional parameter recoveryPointState + - Interface BackupVault has a new optional parameter replicatedRegions + - Interface JobExtendedInfo has a new optional parameter warningDetails + - Type of parameter objectType of interface ItemLevelRestoreCriteria is changed from "ItemPathBasedRestoreCriteria" | "RangeBasedItemLevelRestoreCriteria" | "KubernetesStorageClassRestoreCriteria" | "KubernetesPVRestoreCriteria" | "KubernetesClusterRestoreCriteria" to "ItemPathBasedRestoreCriteria" | "RangeBasedItemLevelRestoreCriteria" | "KubernetesStorageClassRestoreCriteria" | "KubernetesPVRestoreCriteria" | "KubernetesClusterRestoreCriteria" | "KubernetesClusterVaultTierRestoreCriteria" + - Added Enum KnownRecoveryPointCompletionState + - Added Enum KnownResourcePropertiesObjectType -### Other Changes +**Breaking Changes** + - Type of parameter objectType of interface BaseResourceProperties is changed from "BaseResourceProperties" to "DefaultResourceProperties" + - Type of parameter resourceProperties of interface Datasource is changed from BaseResourceProperties to BaseResourcePropertiesUnion + - Type of parameter resourceProperties of interface DatasourceSet is changed from BaseResourceProperties to BaseResourcePropertiesUnion + + ## 1.2.0 (2023-07-10) **Features** @@ -62,4 +107,4 @@ ## 1.0.0 (2023-03-08) -The package of @azure/arm-dataprotection is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart ). +The package of @azure/arm-dataprotection is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/dataprotection/arm-dataprotection/_meta.json b/sdk/dataprotection/arm-dataprotection/_meta.json index ecfdd4e96408..560dc81db73a 100644 --- a/sdk/dataprotection/arm-dataprotection/_meta.json +++ b/sdk/dataprotection/arm-dataprotection/_meta.json @@ -1,8 +1,8 @@ { - "commit": "0f39a2d56070d2bc4251494525cb8af88583a938", + "commit": "68916b755b3b1d944a018a536acdbb22a31f11e6", "readme": "specification/dataprotection/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\dataprotection\\resource-manager\\readme.md --use=@autorest/typescript@6.0.5 --generate-sample=true", + "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/dataprotection/resource-manager/readme.md --use=@autorest/typescript@^6.0.12", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.7.0", - "use": "@autorest/typescript@6.0.5" + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.4", + "use": "@autorest/typescript@^6.0.12" } \ No newline at end of file diff --git a/sdk/dataprotection/arm-dataprotection/package.json b/sdk/dataprotection/arm-dataprotection/package.json index a4ccf62695c3..38062dc63079 100644 --- a/sdk/dataprotection/arm-dataprotection/package.json +++ b/sdk/dataprotection/arm-dataprotection/package.json @@ -3,17 +3,17 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for DataProtectionClient.", - "version": "1.2.1", + "version": "2.0.0", "engines": { "node": ">=18.0.0" }, "dependencies": { - "@azure/core-lro": "^2.5.3", + "@azure/core-lro": "^2.5.4", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.8.0", + "@azure/core-rest-pipeline": "^1.12.0", "tslib": "^2.2.0" }, "keywords": [ @@ -32,17 +32,19 @@ "mkdirp": "^2.1.2", "typescript": "~5.2.0", "uglify-js": "^3.4.9", - "rimraf": "^3.0.0", + "rimraf": "^5.0.0", "dotenv": "^16.0.0", + "@azure/dev-tool": "^1.0.0", "@azure/identity": "^3.3.0", "@azure-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", "mocha": "^10.0.0", + "@types/mocha": "^10.0.0", + "esm": "^3.2.18", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", "@types/node": "^18.0.0", - "@azure/dev-tool": "^1.0.0", "ts-node": "^10.0.0" }, "repository": { @@ -77,7 +79,7 @@ "extract-api": "api-extractor run --local", "lint": "echo skipped", "audit": "echo skipped", - "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", "build:browser": "echo skipped", "build:test": "echo skipped", @@ -105,13 +107,5 @@ ] }, "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/dataprotection/arm-dataprotection", - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-dataprotection?view=azure-node-preview" - } -} + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/dataprotection/arm-dataprotection" +} \ No newline at end of file diff --git a/sdk/dataprotection/arm-dataprotection/review/arm-dataprotection.api.md b/sdk/dataprotection/arm-dataprotection/review/arm-dataprotection.api.md index c903e9dfdbed..5f14fdd6112a 100644 --- a/sdk/dataprotection/arm-dataprotection/review/arm-dataprotection.api.md +++ b/sdk/dataprotection/arm-dataprotection/review/arm-dataprotection.api.md @@ -67,6 +67,7 @@ export interface AzureBackupDiscreteRecoveryPoint extends AzureBackupRecoveryPoi recoveryPointDataStoresDetails?: RecoveryPointDataStoreDetails[]; // (undocumented) recoveryPointId?: string; + recoveryPointState?: RecoveryPointCompletionState; // (undocumented) recoveryPointTime: Date; // (undocumented) @@ -305,10 +306,14 @@ export interface BackupInstances { beginSuspendBackupsAndWait(resourceGroupName: string, vaultName: string, backupInstanceName: string, options?: BackupInstancesSuspendBackupsOptionalParams): Promise; beginSyncBackupInstance(resourceGroupName: string, vaultName: string, backupInstanceName: string, parameters: SyncBackupInstanceRequest, options?: BackupInstancesSyncBackupInstanceOptionalParams): Promise, void>>; beginSyncBackupInstanceAndWait(resourceGroupName: string, vaultName: string, backupInstanceName: string, parameters: SyncBackupInstanceRequest, options?: BackupInstancesSyncBackupInstanceOptionalParams): Promise; + beginTriggerCrossRegionRestore(resourceGroupName: string, location: string, parameters: CrossRegionRestoreRequestObject, options?: BackupInstancesTriggerCrossRegionRestoreOptionalParams): Promise, BackupInstancesTriggerCrossRegionRestoreResponse>>; + beginTriggerCrossRegionRestoreAndWait(resourceGroupName: string, location: string, parameters: CrossRegionRestoreRequestObject, options?: BackupInstancesTriggerCrossRegionRestoreOptionalParams): Promise; beginTriggerRehydrate(resourceGroupName: string, vaultName: string, backupInstanceName: string, parameters: AzureBackupRehydrationRequest, options?: BackupInstancesTriggerRehydrateOptionalParams): Promise, BackupInstancesTriggerRehydrateResponse>>; beginTriggerRehydrateAndWait(resourceGroupName: string, vaultName: string, backupInstanceName: string, parameters: AzureBackupRehydrationRequest, options?: BackupInstancesTriggerRehydrateOptionalParams): Promise; beginTriggerRestore(resourceGroupName: string, vaultName: string, backupInstanceName: string, parameters: AzureBackupRestoreRequestUnion, options?: BackupInstancesTriggerRestoreOptionalParams): Promise, BackupInstancesTriggerRestoreResponse>>; beginTriggerRestoreAndWait(resourceGroupName: string, vaultName: string, backupInstanceName: string, parameters: AzureBackupRestoreRequestUnion, options?: BackupInstancesTriggerRestoreOptionalParams): Promise; + beginValidateCrossRegionRestore(resourceGroupName: string, location: string, parameters: ValidateCrossRegionRestoreRequestObject, options?: BackupInstancesValidateCrossRegionRestoreOptionalParams): Promise, BackupInstancesValidateCrossRegionRestoreResponse>>; + beginValidateCrossRegionRestoreAndWait(resourceGroupName: string, location: string, parameters: ValidateCrossRegionRestoreRequestObject, options?: BackupInstancesValidateCrossRegionRestoreOptionalParams): Promise; beginValidateForBackup(resourceGroupName: string, vaultName: string, parameters: ValidateForBackupRequest, options?: BackupInstancesValidateForBackupOptionalParams): Promise, BackupInstancesValidateForBackupResponse>>; beginValidateForBackupAndWait(resourceGroupName: string, vaultName: string, parameters: ValidateForBackupRequest, options?: BackupInstancesValidateForBackupOptionalParams): Promise; beginValidateForRestore(resourceGroupName: string, vaultName: string, backupInstanceName: string, parameters: ValidateRestoreRequestObject, options?: BackupInstancesValidateForRestoreOptionalParams): Promise, BackupInstancesValidateForRestoreResponse>>; @@ -455,6 +460,22 @@ export interface BackupInstancesSyncBackupInstanceOptionalParams extends coreCli updateIntervalInMs?: number; } +// @public +export interface BackupInstancesTriggerCrossRegionRestoreHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface BackupInstancesTriggerCrossRegionRestoreOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type BackupInstancesTriggerCrossRegionRestoreResponse = OperationJobExtendedInfo; + // @public export interface BackupInstancesTriggerRehydrateHeaders { azureAsyncOperation?: string; @@ -487,6 +508,22 @@ export interface BackupInstancesTriggerRestoreOptionalParams extends coreClient. // @public export type BackupInstancesTriggerRestoreResponse = OperationJobExtendedInfo; +// @public +export interface BackupInstancesValidateCrossRegionRestoreHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface BackupInstancesValidateCrossRegionRestoreOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type BackupInstancesValidateCrossRegionRestoreResponse = OperationJobExtendedInfo; + // @public export interface BackupInstancesValidateForBackupHeaders { azureAsyncOperation?: string; @@ -585,6 +622,7 @@ export interface BackupVault { readonly isVaultProtectedByResourceGuard?: boolean; monitoringSettings?: MonitoringSettings; readonly provisioningState?: ProvisioningState; + replicatedRegions?: string[]; readonly resourceMoveDetails?: ResourceMoveDetails; readonly resourceMoveState?: ResourceMoveState; readonly secureScore?: SecureScoreLevel; @@ -733,9 +771,12 @@ export type BasePolicyRuleUnion = BasePolicyRule | AzureBackupRule | AzureRetent // @public export interface BaseResourceProperties { - objectType: "BaseResourceProperties"; + objectType: "DefaultResourceProperties"; } +// @public (undocumented) +export type BaseResourcePropertiesUnion = BaseResourceProperties | DefaultResourceProperties; + // @public export interface BlobBackupDatasourceParameters extends BackupDatasourceParameters { containersList: string[]; @@ -816,6 +857,38 @@ export type CopyOptionUnion = CopyOption | CopyOnExpiryOption | CustomCopyOption // @public export type CreatedByType = string; +// @public +export interface CrossRegionRestoreDetails { + // (undocumented) + sourceBackupInstanceId: string; + // (undocumented) + sourceRegion: string; +} + +// @public +export interface CrossRegionRestoreJobRequest { + // (undocumented) + jobId: string; + // (undocumented) + sourceBackupVaultId: string; + // (undocumented) + sourceRegion: string; +} + +// @public +export interface CrossRegionRestoreJobsRequest { + // (undocumented) + sourceBackupVaultId: string; + // (undocumented) + sourceRegion: string; +} + +// @public +export interface CrossRegionRestoreRequestObject { + crossRegionRestoreDetails: CrossRegionRestoreDetails; + restoreRequestObject: AzureBackupRestoreRequestUnion; +} + // @public (undocumented) export interface CrossRegionRestoreSettings { state?: CrossRegionRestoreState; @@ -882,6 +955,12 @@ export class DataProtectionClient extends coreClient.ServiceClient { // (undocumented) exportJobsOperationResult: ExportJobsOperationResult; // (undocumented) + fetchCrossRegionRestoreJob: FetchCrossRegionRestoreJob; + // (undocumented) + fetchCrossRegionRestoreJobs: FetchCrossRegionRestoreJobs; + // (undocumented) + fetchSecondaryRecoveryPoints: FetchSecondaryRecoveryPoints; + // (undocumented) jobs: Jobs; // (undocumented) operationResult: OperationResult; @@ -934,7 +1013,7 @@ export interface Datasource { resourceID: string; resourceLocation?: string; resourceName?: string; - resourceProperties?: BaseResourceProperties; + resourceProperties?: BaseResourcePropertiesUnion; resourceType?: string; resourceUri?: string; } @@ -946,7 +1025,7 @@ export interface DatasourceSet { resourceID: string; resourceLocation?: string; resourceName?: string; - resourceProperties?: BaseResourceProperties; + resourceProperties?: BaseResourcePropertiesUnion; resourceType?: string; resourceUri?: string; } @@ -978,6 +1057,11 @@ export interface Day { // @public export type DayOfWeek = string; +// @public +export interface DefaultResourceProperties extends BaseResourceProperties { + objectType: "DefaultResourceProperties"; +} + // @public export interface DeletedBackupInstance extends BackupInstance { readonly deletionInfo?: DeletionInfo; @@ -1191,6 +1275,15 @@ export interface ErrorAdditionalInfo { readonly type?: string; } +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + // @public export interface ErrorModel { readonly additionalInfo?: ErrorAdditionalInfo[]; @@ -1200,6 +1293,11 @@ export interface ErrorModel { readonly target?: string; } +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + // @public export type ExistingResourcePolicy = string; @@ -1287,6 +1385,65 @@ export interface FeatureValidationResponseBase { // @public (undocumented) export type FeatureValidationResponseBaseUnion = FeatureValidationResponseBase | FeatureValidationResponse; +// @public +export interface FetchCrossRegionRestoreJob { + get(resourceGroupName: string, location: string, parameters: CrossRegionRestoreJobRequest, options?: FetchCrossRegionRestoreJobGetOptionalParams): Promise; +} + +// @public +export interface FetchCrossRegionRestoreJobGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FetchCrossRegionRestoreJobGetResponse = AzureBackupJobResource; + +// @public +export interface FetchCrossRegionRestoreJobs { + list(resourceGroupName: string, location: string, parameters: CrossRegionRestoreJobsRequest, options?: FetchCrossRegionRestoreJobsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface FetchCrossRegionRestoreJobsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FetchCrossRegionRestoreJobsListNextResponse = AzureBackupJobResourceList; + +// @public +export interface FetchCrossRegionRestoreJobsListOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type FetchCrossRegionRestoreJobsListResponse = AzureBackupJobResourceList; + +// @public +export interface FetchSecondaryRecoveryPoints { + list(resourceGroupName: string, location: string, parameters: FetchSecondaryRPsRequestParameters, options?: FetchSecondaryRecoveryPointsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface FetchSecondaryRecoveryPointsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FetchSecondaryRecoveryPointsListNextResponse = AzureBackupRecoveryPointResourceList; + +// @public +export interface FetchSecondaryRecoveryPointsListOptionalParams extends coreClient.OperationOptions { + filter?: string; + skipToken?: string; +} + +// @public +export type FetchSecondaryRecoveryPointsListResponse = AzureBackupRecoveryPointResourceList; + +// @public +export interface FetchSecondaryRPsRequestParameters { + sourceBackupInstanceId?: string; + sourceRegion?: string; +} + // @public export function getContinuationToken(page: unknown): string | undefined; @@ -1320,11 +1477,11 @@ export interface InnerError { // @public export interface ItemLevelRestoreCriteria { - objectType: "ItemPathBasedRestoreCriteria" | "RangeBasedItemLevelRestoreCriteria" | "KubernetesStorageClassRestoreCriteria" | "KubernetesPVRestoreCriteria" | "KubernetesClusterRestoreCriteria"; + objectType: "ItemPathBasedRestoreCriteria" | "RangeBasedItemLevelRestoreCriteria" | "KubernetesStorageClassRestoreCriteria" | "KubernetesPVRestoreCriteria" | "KubernetesClusterRestoreCriteria" | "KubernetesClusterVaultTierRestoreCriteria"; } // @public (undocumented) -export type ItemLevelRestoreCriteriaUnion = ItemLevelRestoreCriteria | ItemPathBasedRestoreCriteria | RangeBasedItemLevelRestoreCriteria | KubernetesStorageClassRestoreCriteria | KubernetesPVRestoreCriteria | KubernetesClusterRestoreCriteria; +export type ItemLevelRestoreCriteriaUnion = ItemLevelRestoreCriteria | ItemPathBasedRestoreCriteria | RangeBasedItemLevelRestoreCriteria | KubernetesStorageClassRestoreCriteria | KubernetesPVRestoreCriteria | KubernetesClusterRestoreCriteria | KubernetesClusterVaultTierRestoreCriteria; // @public export interface ItemLevelRestoreTargetInfo extends RestoreTargetInfoBase { @@ -1354,6 +1511,7 @@ export interface JobExtendedInfo { readonly sourceRecoverPoint?: RestoreJobRecoveryPointDetails; readonly subTasks?: JobSubTask[]; readonly targetRecoverPoint?: RestoreJobRecoveryPointDetails; + readonly warningDetails?: UserFacingWarningDetail[]; } // @public @@ -1529,6 +1687,12 @@ export enum KnownRecoveryOption { FailIfExists = "FailIfExists" } +// @public +export enum KnownRecoveryPointCompletionState { + Completed = "Completed", + Partial = "Partial" +} + // @public export enum KnownRehydrationPriority { High = "High", @@ -1559,6 +1723,11 @@ export enum KnownResourceMoveState { Unknown = "Unknown" } +// @public +export enum KnownResourcePropertiesObjectType { + DefaultResourceProperties = "DefaultResourceProperties" +} + // @public export enum KnownRestoreSourceDataStoreType { ArchiveStore = "ArchiveStore", @@ -1678,6 +1847,25 @@ export interface KubernetesClusterRestoreCriteria extends ItemLevelRestoreCriter restoreHookReferences?: NamespacedNameResource[]; } +// @public +export interface KubernetesClusterVaultTierRestoreCriteria extends ItemLevelRestoreCriteria { + conflictPolicy?: ExistingResourcePolicy; + excludedNamespaces?: string[]; + excludedResourceTypes?: string[]; + includeClusterScopeResources: boolean; + includedNamespaces?: string[]; + includedResourceTypes?: string[]; + labelSelectors?: string[]; + namespaceMappings?: { + [propertyName: string]: string; + }; + objectType: "KubernetesClusterVaultTierRestoreCriteria"; + persistentVolumeRestoreMode?: PersistentVolumeRestoreMode; + restoreHookReferences?: NamespacedNameResource[]; + stagingResourceGroupId?: string; + stagingStorageAccountId?: string; +} + // @public export interface KubernetesPVRestoreCriteria extends ItemLevelRestoreCriteria { name?: string; @@ -1846,6 +2034,9 @@ export interface RangeBasedItemLevelRestoreCriteria extends ItemLevelRestoreCrit // @public export type RecoveryOption = string; +// @public +export type RecoveryPointCompletionState = string; + // @public export interface RecoveryPointDataStoreDetails { // (undocumented) @@ -2185,6 +2376,9 @@ export interface ResourceMoveDetails { // @public export type ResourceMoveState = string; +// @public +export type ResourcePropertiesObjectType = string; + // @public (undocumented) export interface RestorableTimeRange { endTime: string; @@ -2424,6 +2618,18 @@ export interface UserFacingError { target?: string; } +// @public +export interface UserFacingWarningDetail { + resourceName?: string; + warning: UserFacingError; +} + +// @public +export interface ValidateCrossRegionRestoreRequestObject { + crossRegionRestoreDetails: CrossRegionRestoreDetails; + restoreRequestObject: AzureBackupRestoreRequestUnion; +} + // @public export interface ValidateForBackupRequest { backupInstance: BackupInstance; diff --git a/sdk/dataprotection/arm-dataprotection/src/dataProtectionClient.ts b/sdk/dataprotection/arm-dataprotection/src/dataProtectionClient.ts index ce0888aa2f64..06efacb261b6 100644 --- a/sdk/dataprotection/arm-dataprotection/src/dataProtectionClient.ts +++ b/sdk/dataprotection/arm-dataprotection/src/dataProtectionClient.ts @@ -26,6 +26,9 @@ import { BackupPoliciesImpl, BackupInstancesImpl, RecoveryPointsImpl, + FetchSecondaryRecoveryPointsImpl, + FetchCrossRegionRestoreJobImpl, + FetchCrossRegionRestoreJobsImpl, JobsImpl, RestorableTimeRangesImpl, ExportJobsImpl, @@ -46,6 +49,9 @@ import { BackupPolicies, BackupInstances, RecoveryPoints, + FetchSecondaryRecoveryPoints, + FetchCrossRegionRestoreJob, + FetchCrossRegionRestoreJobs, Jobs, RestorableTimeRanges, ExportJobs, @@ -102,7 +108,7 @@ export class DataProtectionClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-dataprotection/1.2.1`; + const packageDetails = `azsdk-js-arm-dataprotection/2.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -155,7 +161,7 @@ export class DataProtectionClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2023-05-01"; + this.apiVersion = options.apiVersion || "2023-11-01"; this.backupVaults = new BackupVaultsImpl(this); this.operationResult = new OperationResultImpl(this); this.operationStatus = new OperationStatusImpl(this); @@ -173,6 +179,13 @@ export class DataProtectionClient extends coreClient.ServiceClient { this.backupPolicies = new BackupPoliciesImpl(this); this.backupInstances = new BackupInstancesImpl(this); this.recoveryPoints = new RecoveryPointsImpl(this); + this.fetchSecondaryRecoveryPoints = new FetchSecondaryRecoveryPointsImpl( + this + ); + this.fetchCrossRegionRestoreJob = new FetchCrossRegionRestoreJobImpl(this); + this.fetchCrossRegionRestoreJobs = new FetchCrossRegionRestoreJobsImpl( + this + ); this.jobs = new JobsImpl(this); this.restorableTimeRanges = new RestorableTimeRangesImpl(this); this.exportJobs = new ExportJobsImpl(this); @@ -222,6 +235,9 @@ export class DataProtectionClient extends coreClient.ServiceClient { backupPolicies: BackupPolicies; backupInstances: BackupInstances; recoveryPoints: RecoveryPoints; + fetchSecondaryRecoveryPoints: FetchSecondaryRecoveryPoints; + fetchCrossRegionRestoreJob: FetchCrossRegionRestoreJob; + fetchCrossRegionRestoreJobs: FetchCrossRegionRestoreJobs; jobs: Jobs; restorableTimeRanges: RestorableTimeRanges; exportJobs: ExportJobs; diff --git a/sdk/dataprotection/arm-dataprotection/src/models/index.ts b/sdk/dataprotection/arm-dataprotection/src/models/index.ts index 9a79488b2a2e..5565bb3e34cf 100644 --- a/sdk/dataprotection/arm-dataprotection/src/models/index.ts +++ b/sdk/dataprotection/arm-dataprotection/src/models/index.ts @@ -18,6 +18,9 @@ export type FeatureValidationResponseBaseUnion = | FeatureValidationResponseBase | FeatureValidationResponse; export type BaseBackupPolicyUnion = BaseBackupPolicy | BackupPolicy; +export type BaseResourcePropertiesUnion = + | BaseResourceProperties + | DefaultResourceProperties; export type DataStoreParametersUnion = | DataStoreParameters | AzureOperationalStoreParameters; @@ -62,7 +65,8 @@ export type ItemLevelRestoreCriteriaUnion = | RangeBasedItemLevelRestoreCriteria | KubernetesStorageClassRestoreCriteria | KubernetesPVRestoreCriteria - | KubernetesClusterRestoreCriteria; + | KubernetesClusterRestoreCriteria + | KubernetesClusterVaultTierRestoreCriteria; export type AzureBackupRecoveryPointBasedRestoreRequestUnion = | AzureBackupRecoveryPointBasedRestoreRequest | AzureBackupRestoreWithRehydrationRequest; @@ -102,6 +106,8 @@ export interface BackupVault { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly secureScore?: SecureScoreLevel; + /** List of replicated regions for Backup Vault */ + replicatedRegions?: string[]; } /** Monitoring Settings */ @@ -532,13 +538,13 @@ export interface Datasource { /** Uri of the resource. */ resourceUri?: string; /** Properties specific to data source */ - resourceProperties?: BaseResourceProperties; + resourceProperties?: BaseResourcePropertiesUnion; } /** Properties which are specific to datasource/datasourceSets */ export interface BaseResourceProperties { /** Polymorphic discriminator, which specifies the different types this object can be */ - objectType: "BaseResourceProperties"; + objectType: "DefaultResourceProperties"; } /** DatasourceSet details of datasource to be backed up */ @@ -558,7 +564,7 @@ export interface DatasourceSet { /** Uri of the resource. */ resourceUri?: string; /** Properties specific to data source set */ - resourceProperties?: BaseResourceProperties; + resourceProperties?: BaseResourcePropertiesUnion; } /** Policy Info in backupInstance */ @@ -701,14 +707,24 @@ export interface AzureBackupRecoveryPoint { objectType: "AzureBackupDiscreteRecoveryPoint"; } -/** Azure Backup Rehydrate Request */ -export interface AzureBackupRehydrationRequest { - /** Id of the recovery point to be recovered */ - recoveryPointId: string; - /** Priority to be used for rehydration. Values High or Standard */ - rehydrationPriority?: RehydrationPriority; - /** Retention duration in ISO 8601 format i.e P10D . */ - rehydrationRetentionDuration: string; +/** + * Information about BI whose secondary RecoveryPoints are requested + * Source region and + * BI ARM path + */ +export interface FetchSecondaryRPsRequestParameters { + /** Source region in which BackupInstance is located */ + sourceRegion?: string; + /** ARM Path of BackupInstance */ + sourceBackupInstanceId?: string; +} + +/** Cross Region Restore Request Object */ +export interface CrossRegionRestoreRequestObject { + /** Gets or sets the restore request object. */ + restoreRequestObject: AzureBackupRestoreRequestUnion; + /** Cross region restore details. */ + crossRegionRestoreDetails: CrossRegionRestoreDetails; } /** Azure backup restore request */ @@ -744,16 +760,60 @@ export interface RestoreTargetInfoBase { restoreLocation?: string; } -/** Sync BackupInstance Request */ -export interface SyncBackupInstanceRequest { - /** Field indicating sync type e.g. to sync only in case of failure or in all cases */ - syncType?: SyncType; +/** Cross Region Restore details */ +export interface CrossRegionRestoreDetails { + sourceRegion: string; + sourceBackupInstanceId: string; } -/** Validate restore request object */ -export interface ValidateRestoreRequestObject { +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** Cross Region Restore Request Object */ +export interface ValidateCrossRegionRestoreRequestObject { /** Gets or sets the restore request object. */ restoreRequestObject: AzureBackupRestoreRequestUnion; + /** Cross region restore details. */ + crossRegionRestoreDetails: CrossRegionRestoreDetails; +} + +/** Details of CRR Job to be fetched */ +export interface CrossRegionRestoreJobRequest { + sourceRegion: string; + sourceBackupVaultId: string; + jobId: string; } /** AzureBackup Job Class */ @@ -880,6 +940,11 @@ export interface JobExtendedInfo { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly targetRecoverPoint?: RestoreJobRecoveryPointDetails; + /** + * A List, detailing the warnings related to the job + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly warningDetails?: UserFacingWarningDetail[]; } export interface RestoreJobRecoveryPointDetails { @@ -904,6 +969,42 @@ export interface JobSubTask { taskStatus: string; } +/** Warning object used by layers that have access to localized content, and propagate that to user */ +export interface UserFacingWarningDetail { + /** Name of resource for which warning is raised. */ + resourceName?: string; + /** Error details for the warning. */ + warning: UserFacingError; +} + +/** Details of Backup Vault for which CRR Jobs are to be fetched */ +export interface CrossRegionRestoreJobsRequest { + sourceRegion: string; + sourceBackupVaultId: string; +} + +/** Azure Backup Rehydrate Request */ +export interface AzureBackupRehydrationRequest { + /** Id of the recovery point to be recovered */ + recoveryPointId: string; + /** Priority to be used for rehydration. Values High or Standard */ + rehydrationPriority?: RehydrationPriority; + /** Retention duration in ISO 8601 format i.e P10D . */ + rehydrationRetentionDuration: string; +} + +/** Sync BackupInstance Request */ +export interface SyncBackupInstanceRequest { + /** Field indicating sync type e.g. to sync only in case of failure or in all cases */ + syncType?: SyncType; +} + +/** Validate restore request object */ +export interface ValidateRestoreRequestObject { + /** Gets or sets the restore request object. */ + restoreRequestObject: AzureBackupRestoreRequestUnion; +} + /** List Restore Ranges Request */ export interface AzureBackupFindRestorableTimeRangesRequest { /** Gets or sets the type of the source data store. */ @@ -1244,7 +1345,8 @@ export interface ItemLevelRestoreCriteria { | "RangeBasedItemLevelRestoreCriteria" | "KubernetesStorageClassRestoreCriteria" | "KubernetesPVRestoreCriteria" - | "KubernetesClusterRestoreCriteria"; + | "KubernetesClusterRestoreCriteria" + | "KubernetesClusterVaultTierRestoreCriteria"; } /** Class encapsulating target details, used where the destination is not a datasource */ @@ -1347,7 +1449,7 @@ export interface ResourceGuardProxyBaseResourceList extends DppResourceList { export interface OperationJobExtendedInfo extends OperationExtendedInfo { /** Polymorphic discriminator, which specifies the different types this object can be */ objectType: "OperationJobExtendedInfo"; - /** Arm Id of the job created for this operation. */ + /** Name or Arm Id of the job created for this operation. */ jobId?: string; } @@ -1426,6 +1528,12 @@ export interface DeletedBackupInstance extends BackupInstance { readonly deletionInfo?: DeletionInfo; } +/** Default source properties */ +export interface DefaultResourceProperties extends BaseResourceProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "DefaultResourceProperties"; +} + /** Parameters for Operational-Tier DataStore */ export interface AzureOperationalStoreParameters extends DataStoreParameters { /** Polymorphic discriminator, which specifies the different types this object can be */ @@ -1496,6 +1604,8 @@ export interface AzureBackupDiscreteRecoveryPoint retentionTagVersion?: string; /** NOTE: This property will not be serialized. It can only be populated by the server. */ readonly expiryTime?: Date; + /** Specifies recovery point completeness. Partial (i.e., only some of the intended items were backed up), or Completed (i.e., ALL intended items were backed up). */ + recoveryPointState?: RecoveryPointCompletionState; } /** Azure backup recoveryPoint based restore request */ @@ -1728,6 +1838,37 @@ export interface KubernetesClusterRestoreCriteria restoreHookReferences?: NamespacedNameResource[]; } +/** kubernetes Cluster Backup target info for restore operation from vault */ +export interface KubernetesClusterVaultTierRestoreCriteria + extends ItemLevelRestoreCriteria { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "KubernetesClusterVaultTierRestoreCriteria"; + /** Gets or sets the include cluster resources property. This property if enabled will include cluster scope resources during restore from vault. */ + includeClusterScopeResources: boolean; + /** Gets or sets the include namespaces property. This property sets the namespaces to be included during restore from vault. */ + includedNamespaces?: string[]; + /** Gets or sets the exclude namespaces property. This property sets the namespaces to be excluded during restore from vault. */ + excludedNamespaces?: string[]; + /** Gets or sets the include resource types property. This property sets the resource types to be included during restore from vault. */ + includedResourceTypes?: string[]; + /** Gets or sets the exclude resource types property. This property sets the resource types to be excluded during restore from vault. */ + excludedResourceTypes?: string[]; + /** Gets or sets the LabelSelectors property. This property sets the resource with such label selectors to be included during restore from vault. */ + labelSelectors?: string[]; + /** Gets or sets the PV (Persistent Volume) Restore Mode property. This property sets whether volumes needs to be restored from vault. */ + persistentVolumeRestoreMode?: PersistentVolumeRestoreMode; + /** Gets or sets the Conflict Policy property. This property sets policy during conflict of resources during restore from vault. */ + conflictPolicy?: ExistingResourcePolicy; + /** Gets or sets the Namespace Mappings property. This property sets if namespace needs to be change during restore from vault. */ + namespaceMappings?: { [propertyName: string]: string }; + /** Gets or sets the restore hook references. This property sets the hook reference to be executed during restore from vault. */ + restoreHookReferences?: NamespacedNameResource[]; + /** Gets or sets the staging RG Id for creating staging disks and snapshots during restore from vault. */ + stagingResourceGroupId?: string; + /** Gets or sets the staging Storage Account Id for creating backup extension object store data during restore from vault. */ + stagingStorageAccountId?: string; +} + /** Backup Vault Resource */ export interface BackupVaultResource extends DppTrackedResource { /** BackupVaultResource properties */ @@ -1803,6 +1944,26 @@ export interface BackupInstancesValidateForBackupHeaders { retryAfter?: number; } +/** Defines headers for BackupInstances_triggerCrossRegionRestore operation. */ +export interface BackupInstancesTriggerCrossRegionRestoreHeaders { + /** The URL of the resource used to check the status of the asynchronous operation. */ + location?: string; + /** The URL of the resource used to check the status of the asynchronous operation. */ + azureAsyncOperation?: string; + /** Suggested delay to check the status of the asynchronous operation. The value is an integer that represents the seconds. */ + retryAfter?: number; +} + +/** Defines headers for BackupInstances_validateCrossRegionRestore operation. */ +export interface BackupInstancesValidateCrossRegionRestoreHeaders { + /** The URL of the resource used to check the status of the asynchronous operation. */ + location?: string; + /** The URL of the resource used to check the status of the asynchronous operation. */ + azureAsyncOperation?: string; + /** Suggested delay to check the status of the asynchronous operation. The value is an integer that represents the seconds. */ + retryAfter?: number; +} + /** Defines headers for BackupInstances_triggerRehydrate operation. */ export interface BackupInstancesTriggerRehydrateHeaders { /** The URL of the resource used to check the status of the asynchronous operation. */ @@ -2152,6 +2313,21 @@ export enum KnownCreatedByType { */ export type CreatedByType = string; +/** Known values of {@link ResourcePropertiesObjectType} that the service accepts. */ +export enum KnownResourcePropertiesObjectType { + /** DefaultResourceProperties */ + DefaultResourceProperties = "DefaultResourceProperties" +} + +/** + * Defines values for ResourcePropertiesObjectType. \ + * {@link KnownResourcePropertiesObjectType} can be used interchangeably with ResourcePropertiesObjectType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **DefaultResourceProperties** + */ +export type ResourcePropertiesObjectType = string; + /** Known values of {@link DataStoreTypes} that the service accepts. */ export enum KnownDataStoreTypes { /** OperationalStore */ @@ -2269,27 +2445,6 @@ export enum KnownValidationType { */ export type ValidationType = string; -/** Known values of {@link RehydrationPriority} that the service accepts. */ -export enum KnownRehydrationPriority { - /** Invalid */ - Invalid = "Invalid", - /** High */ - High = "High", - /** Standard */ - Standard = "Standard" -} - -/** - * Defines values for RehydrationPriority. \ - * {@link KnownRehydrationPriority} can be used interchangeably with RehydrationPriority, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Invalid** \ - * **High** \ - * **Standard** - */ -export type RehydrationPriority = string; - /** Known values of {@link RecoveryOption} that the service accepts. */ export enum KnownRecoveryOption { /** FailIfExists */ @@ -2329,6 +2484,27 @@ export enum KnownSourceDataStoreType { */ export type SourceDataStoreType = string; +/** Known values of {@link RehydrationPriority} that the service accepts. */ +export enum KnownRehydrationPriority { + /** Invalid */ + Invalid = "Invalid", + /** High */ + High = "High", + /** Standard */ + Standard = "Standard" +} + +/** + * Defines values for RehydrationPriority. \ + * {@link KnownRehydrationPriority} can be used interchangeably with RehydrationPriority, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Invalid** \ + * **High** \ + * **Standard** + */ +export type RehydrationPriority = string; + /** Known values of {@link SyncType} that the service accepts. */ export enum KnownSyncType { /** Default */ @@ -2395,6 +2571,24 @@ export enum KnownRehydrationStatus { */ export type RehydrationStatus = string; +/** Known values of {@link RecoveryPointCompletionState} that the service accepts. */ +export enum KnownRecoveryPointCompletionState { + /** Completed */ + Completed = "Completed", + /** Partial */ + Partial = "Partial" +} + +/** + * Defines values for RecoveryPointCompletionState. \ + * {@link KnownRecoveryPointCompletionState} can be used interchangeably with RecoveryPointCompletionState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Completed** \ + * **Partial** + */ +export type RecoveryPointCompletionState = string; + /** Known values of {@link FeatureType} that the service accepts. */ export enum KnownFeatureType { /** Invalid */ @@ -2882,6 +3076,30 @@ export interface BackupInstancesGetBackupInstanceOperationResultOptionalParams /** Contains response data for the getBackupInstanceOperationResult operation. */ export type BackupInstancesGetBackupInstanceOperationResultResponse = BackupInstanceResource; +/** Optional parameters. */ +export interface BackupInstancesTriggerCrossRegionRestoreOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the triggerCrossRegionRestore operation. */ +export type BackupInstancesTriggerCrossRegionRestoreResponse = OperationJobExtendedInfo; + +/** Optional parameters. */ +export interface BackupInstancesValidateCrossRegionRestoreOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the validateCrossRegionRestore operation. */ +export type BackupInstancesValidateCrossRegionRestoreResponse = OperationJobExtendedInfo; + /** Optional parameters. */ export interface BackupInstancesTriggerRehydrateOptionalParams extends coreClient.OperationOptions { @@ -2996,6 +3214,49 @@ export interface RecoveryPointsListNextOptionalParams /** Contains response data for the listNext operation. */ export type RecoveryPointsListNextResponse = AzureBackupRecoveryPointResourceList; +/** Optional parameters. */ +export interface FetchSecondaryRecoveryPointsListOptionalParams + extends coreClient.OperationOptions { + /** OData filter options. */ + filter?: string; + /** skipToken Filter. */ + skipToken?: string; +} + +/** Contains response data for the list operation. */ +export type FetchSecondaryRecoveryPointsListResponse = AzureBackupRecoveryPointResourceList; + +/** Optional parameters. */ +export interface FetchSecondaryRecoveryPointsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type FetchSecondaryRecoveryPointsListNextResponse = AzureBackupRecoveryPointResourceList; + +/** Optional parameters. */ +export interface FetchCrossRegionRestoreJobGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type FetchCrossRegionRestoreJobGetResponse = AzureBackupJobResource; + +/** Optional parameters. */ +export interface FetchCrossRegionRestoreJobsListOptionalParams + extends coreClient.OperationOptions { + /** OData filter options. */ + filter?: string; +} + +/** Contains response data for the list operation. */ +export type FetchCrossRegionRestoreJobsListResponse = AzureBackupJobResourceList; + +/** Optional parameters. */ +export interface FetchCrossRegionRestoreJobsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type FetchCrossRegionRestoreJobsListNextResponse = AzureBackupJobResourceList; + /** Optional parameters. */ export interface JobsListOptionalParams extends coreClient.OperationOptions {} diff --git a/sdk/dataprotection/arm-dataprotection/src/models/mappers.ts b/sdk/dataprotection/arm-dataprotection/src/models/mappers.ts index 81a32fbef7e3..748e86ac9e9b 100644 --- a/sdk/dataprotection/arm-dataprotection/src/models/mappers.ts +++ b/sdk/dataprotection/arm-dataprotection/src/models/mappers.ts @@ -81,6 +81,17 @@ export const BackupVault: coreClient.CompositeMapper = { type: { name: "String" } + }, + replicatedRegions: { + serializedName: "replicatedRegions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } } } } @@ -1172,7 +1183,6 @@ export const Datasource: coreClient.CompositeMapper = { }; export const BaseResourceProperties: coreClient.CompositeMapper = { - serializedName: "BaseResourceProperties", type: { name: "Composite", className: "BaseResourceProperties", @@ -1668,29 +1678,44 @@ export const AzureBackupRecoveryPoint: coreClient.CompositeMapper = { } }; -export const AzureBackupRehydrationRequest: coreClient.CompositeMapper = { +export const FetchSecondaryRPsRequestParameters: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AzureBackupRehydrationRequest", + className: "FetchSecondaryRPsRequestParameters", modelProperties: { - recoveryPointId: { - serializedName: "recoveryPointId", - required: true, + sourceRegion: { + serializedName: "sourceRegion", type: { name: "String" } }, - rehydrationPriority: { - serializedName: "rehydrationPriority", + sourceBackupInstanceId: { + serializedName: "sourceBackupInstanceId", type: { name: "String" } + } + } + } +}; + +export const CrossRegionRestoreRequestObject: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CrossRegionRestoreRequestObject", + modelProperties: { + restoreRequestObject: { + serializedName: "restoreRequestObject", + type: { + name: "Composite", + className: "AzureBackupRestoreRequest" + } }, - rehydrationRetentionDuration: { - serializedName: "rehydrationRetentionDuration", - required: true, + crossRegionRestoreDetails: { + serializedName: "crossRegionRestoreDetails", type: { - name: "String" + name: "Composite", + className: "CrossRegionRestoreDetails" } } } @@ -1779,13 +1804,21 @@ export const RestoreTargetInfoBase: coreClient.CompositeMapper = { } }; -export const SyncBackupInstanceRequest: coreClient.CompositeMapper = { +export const CrossRegionRestoreDetails: coreClient.CompositeMapper = { type: { name: "Composite", - className: "SyncBackupInstanceRequest", + className: "CrossRegionRestoreDetails", modelProperties: { - syncType: { - serializedName: "syncType", + sourceRegion: { + serializedName: "sourceRegion", + required: true, + type: { + name: "String" + } + }, + sourceBackupInstanceId: { + serializedName: "sourceBackupInstanceId", + required: true, type: { name: "String" } @@ -1794,10 +1827,82 @@ export const SyncBackupInstanceRequest: coreClient.CompositeMapper = { } }; -export const ValidateRestoreRequestObject: coreClient.CompositeMapper = { +export const ErrorResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ValidateRestoreRequestObject", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ValidateCrossRegionRestoreRequestObject: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ValidateCrossRegionRestoreRequestObject", modelProperties: { restoreRequestObject: { serializedName: "restoreRequestObject", @@ -1805,6 +1910,43 @@ export const ValidateRestoreRequestObject: coreClient.CompositeMapper = { name: "Composite", className: "AzureBackupRestoreRequest" } + }, + crossRegionRestoreDetails: { + serializedName: "crossRegionRestoreDetails", + type: { + name: "Composite", + className: "CrossRegionRestoreDetails" + } + } + } + } +}; + +export const CrossRegionRestoreJobRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CrossRegionRestoreJobRequest", + modelProperties: { + sourceRegion: { + serializedName: "sourceRegion", + required: true, + type: { + name: "String" + } + }, + sourceBackupVaultId: { + serializedName: "sourceBackupVaultId", + required: true, + type: { + name: "String" + } + }, + jobId: { + serializedName: "jobId", + required: true, + type: { + name: "String" + } } } } @@ -2101,6 +2243,19 @@ export const JobExtendedInfo: coreClient.CompositeMapper = { name: "Composite", className: "RestoreJobRecoveryPointDetails" } + }, + warningDetails: { + serializedName: "warningDetails", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "UserFacingWarningDetail" + } + } + } } } } @@ -2171,6 +2326,111 @@ export const JobSubTask: coreClient.CompositeMapper = { } }; +export const UserFacingWarningDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UserFacingWarningDetail", + modelProperties: { + resourceName: { + serializedName: "resourceName", + type: { + name: "String" + } + }, + warning: { + serializedName: "warning", + type: { + name: "Composite", + className: "UserFacingError" + } + } + } + } +}; + +export const CrossRegionRestoreJobsRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CrossRegionRestoreJobsRequest", + modelProperties: { + sourceRegion: { + serializedName: "sourceRegion", + required: true, + type: { + name: "String" + } + }, + sourceBackupVaultId: { + serializedName: "sourceBackupVaultId", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const AzureBackupRehydrationRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureBackupRehydrationRequest", + modelProperties: { + recoveryPointId: { + serializedName: "recoveryPointId", + required: true, + type: { + name: "String" + } + }, + rehydrationPriority: { + serializedName: "rehydrationPriority", + type: { + name: "String" + } + }, + rehydrationRetentionDuration: { + serializedName: "rehydrationRetentionDuration", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const SyncBackupInstanceRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SyncBackupInstanceRequest", + modelProperties: { + syncType: { + serializedName: "syncType", + type: { + name: "String" + } + } + } + } +}; + +export const ValidateRestoreRequestObject: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ValidateRestoreRequestObject", + modelProperties: { + restoreRequestObject: { + serializedName: "restoreRequestObject", + type: { + name: "Composite", + className: "AzureBackupRestoreRequest" + } + } + } + } +}; + export const AzureBackupFindRestorableTimeRangesRequest: coreClient.CompositeMapper = { type: { name: "Composite", @@ -3671,6 +3931,20 @@ export const DeletedBackupInstance: coreClient.CompositeMapper = { } }; +export const DefaultResourceProperties: coreClient.CompositeMapper = { + serializedName: "DefaultResourceProperties", + type: { + name: "Composite", + className: "DefaultResourceProperties", + uberParent: "BaseResourceProperties", + polymorphicDiscriminator: + BaseResourceProperties.type.polymorphicDiscriminator, + modelProperties: { + ...BaseResourceProperties.type.modelProperties + } + } +}; + export const AzureOperationalStoreParameters: coreClient.CompositeMapper = { serializedName: "AzureOperationalStoreParameters", type: { @@ -3925,6 +4199,12 @@ export const AzureBackupDiscreteRecoveryPoint: coreClient.CompositeMapper = { type: { name: "DateTime" } + }, + recoveryPointState: { + serializedName: "recoveryPointState", + type: { + name: "String" + } } } } @@ -4618,6 +4898,125 @@ export const KubernetesClusterRestoreCriteria: coreClient.CompositeMapper = { } }; +export const KubernetesClusterVaultTierRestoreCriteria: coreClient.CompositeMapper = { + serializedName: "KubernetesClusterVaultTierRestoreCriteria", + type: { + name: "Composite", + className: "KubernetesClusterVaultTierRestoreCriteria", + uberParent: "ItemLevelRestoreCriteria", + polymorphicDiscriminator: + ItemLevelRestoreCriteria.type.polymorphicDiscriminator, + modelProperties: { + ...ItemLevelRestoreCriteria.type.modelProperties, + includeClusterScopeResources: { + serializedName: "includeClusterScopeResources", + required: true, + type: { + name: "Boolean" + } + }, + includedNamespaces: { + serializedName: "includedNamespaces", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + excludedNamespaces: { + serializedName: "excludedNamespaces", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + includedResourceTypes: { + serializedName: "includedResourceTypes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + excludedResourceTypes: { + serializedName: "excludedResourceTypes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + labelSelectors: { + serializedName: "labelSelectors", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + persistentVolumeRestoreMode: { + serializedName: "persistentVolumeRestoreMode", + type: { + name: "String" + } + }, + conflictPolicy: { + serializedName: "conflictPolicy", + type: { + name: "String" + } + }, + namespaceMappings: { + serializedName: "namespaceMappings", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + restoreHookReferences: { + serializedName: "restoreHookReferences", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "NamespacedNameResource" + } + } + } + }, + stagingResourceGroupId: { + serializedName: "stagingResourceGroupId", + type: { + name: "String" + } + }, + stagingStorageAccountId: { + serializedName: "stagingStorageAccountId", + type: { + name: "String" + } + } + } + } +}; + export const BackupVaultResource: coreClient.CompositeMapper = { type: { name: "Composite", @@ -4819,6 +5218,60 @@ export const BackupInstancesValidateForBackupHeaders: coreClient.CompositeMapper } }; +export const BackupInstancesTriggerCrossRegionRestoreHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupInstancesTriggerCrossRegionRestoreHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const BackupInstancesValidateCrossRegionRestoreHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupInstancesValidateCrossRegionRestoreHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + export const BackupInstancesTriggerRehydrateHeaders: coreClient.CompositeMapper = { type: { name: "Composite", @@ -5061,7 +5514,7 @@ export let discriminators = { FeatureValidationRequestBase: FeatureValidationRequestBase, FeatureValidationResponseBase: FeatureValidationResponseBase, BaseBackupPolicy: BaseBackupPolicy, - "BaseResourceProperties.BaseResourceProperties": BaseResourceProperties, + BaseResourceProperties: BaseResourceProperties, DataStoreParameters: DataStoreParameters, BackupDatasourceParameters: BackupDatasourceParameters, AuthCredentials: AuthCredentials, @@ -5079,6 +5532,7 @@ export let discriminators = { "FeatureValidationRequestBase.FeatureValidationRequest": FeatureValidationRequest, "FeatureValidationResponseBase.FeatureValidationResponse": FeatureValidationResponse, "BaseBackupPolicy.BackupPolicy": BackupPolicy, + "BaseResourceProperties.DefaultResourceProperties": DefaultResourceProperties, "DataStoreParameters.AzureOperationalStoreParameters": AzureOperationalStoreParameters, "BackupDatasourceParameters.KubernetesClusterBackupDatasourceParameters": KubernetesClusterBackupDatasourceParameters, "BackupDatasourceParameters.BlobBackupDatasourceParameters": BlobBackupDatasourceParameters, @@ -5104,5 +5558,6 @@ export let discriminators = { "ItemLevelRestoreCriteria.KubernetesStorageClassRestoreCriteria": KubernetesStorageClassRestoreCriteria, "ItemLevelRestoreCriteria.KubernetesPVRestoreCriteria": KubernetesPVRestoreCriteria, "ItemLevelRestoreCriteria.KubernetesClusterRestoreCriteria": KubernetesClusterRestoreCriteria, + "ItemLevelRestoreCriteria.KubernetesClusterVaultTierRestoreCriteria": KubernetesClusterVaultTierRestoreCriteria, "AzureBackupRecoveryPointBasedRestoreRequest.AzureBackupRestoreWithRehydrationRequest": AzureBackupRestoreWithRehydrationRequest }; diff --git a/sdk/dataprotection/arm-dataprotection/src/models/parameters.ts b/sdk/dataprotection/arm-dataprotection/src/models/parameters.ts index bd7a849ddf8f..c4bcab1816d2 100644 --- a/sdk/dataprotection/arm-dataprotection/src/models/parameters.ts +++ b/sdk/dataprotection/arm-dataprotection/src/models/parameters.ts @@ -20,10 +20,15 @@ import { BackupInstanceResource as BackupInstanceResourceMapper, TriggerBackupRequest as TriggerBackupRequestMapper, ValidateForBackupRequest as ValidateForBackupRequestMapper, + CrossRegionRestoreRequestObject as CrossRegionRestoreRequestObjectMapper, + ValidateCrossRegionRestoreRequestObject as ValidateCrossRegionRestoreRequestObjectMapper, AzureBackupRehydrationRequest as AzureBackupRehydrationRequestMapper, AzureBackupRestoreRequest as AzureBackupRestoreRequestMapper, SyncBackupInstanceRequest as SyncBackupInstanceRequestMapper, ValidateRestoreRequestObject as ValidateRestoreRequestObjectMapper, + FetchSecondaryRPsRequestParameters as FetchSecondaryRPsRequestParametersMapper, + CrossRegionRestoreJobRequest as CrossRegionRestoreJobRequestMapper, + CrossRegionRestoreJobsRequest as CrossRegionRestoreJobsRequestMapper, AzureBackupFindRestorableTimeRangesRequest as AzureBackupFindRestorableTimeRangesRequestMapper, ResourceGuardResource as ResourceGuardResourceMapper, PatchResourceGuardInput as PatchResourceGuardInputMapper, @@ -58,7 +63,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2023-05-01", + defaultValue: "2023-11-01", isConstant: true, serializedName: "api-version", type: { @@ -214,20 +219,44 @@ export const parameters7: OperationParameter = { export const parameters8: OperationParameter = { parameterPath: "parameters", - mapper: AzureBackupRehydrationRequestMapper + mapper: CrossRegionRestoreRequestObjectMapper +}; + +export const location1: OperationURLParameter = { + parameterPath: "location", + mapper: { + constraints: { + MinLength: 1 + }, + serializedName: "location", + required: true, + type: { + name: "String" + } + } }; export const parameters9: OperationParameter = { parameterPath: "parameters", - mapper: AzureBackupRestoreRequestMapper + mapper: ValidateCrossRegionRestoreRequestObjectMapper }; export const parameters10: OperationParameter = { parameterPath: "parameters", - mapper: SyncBackupInstanceRequestMapper + mapper: AzureBackupRehydrationRequestMapper }; export const parameters11: OperationParameter = { + parameterPath: "parameters", + mapper: AzureBackupRestoreRequestMapper +}; + +export const parameters12: OperationParameter = { + parameterPath: "parameters", + mapper: SyncBackupInstanceRequestMapper +}; + +export const parameters13: OperationParameter = { parameterPath: "parameters", mapper: ValidateRestoreRequestObjectMapper }; @@ -263,6 +292,21 @@ export const recoveryPointId: OperationURLParameter = { } }; +export const parameters14: OperationParameter = { + parameterPath: "parameters", + mapper: FetchSecondaryRPsRequestParametersMapper +}; + +export const parameters15: OperationParameter = { + parameterPath: "parameters", + mapper: CrossRegionRestoreJobRequestMapper +}; + +export const parameters16: OperationParameter = { + parameterPath: "parameters", + mapper: CrossRegionRestoreJobsRequestMapper +}; + export const jobId: OperationURLParameter = { parameterPath: "jobId", mapper: { @@ -274,12 +318,12 @@ export const jobId: OperationURLParameter = { } }; -export const parameters12: OperationParameter = { +export const parameters17: OperationParameter = { parameterPath: "parameters", mapper: AzureBackupFindRestorableTimeRangesRequestMapper }; -export const parameters13: OperationParameter = { +export const parameters18: OperationParameter = { parameterPath: "parameters", mapper: ResourceGuardResourceMapper }; @@ -295,7 +339,7 @@ export const resourceGuardsName: OperationURLParameter = { } }; -export const parameters14: OperationParameter = { +export const parameters19: OperationParameter = { parameterPath: "parameters", mapper: PatchResourceGuardInputMapper }; @@ -325,12 +369,12 @@ export const resourceGuardProxyName: OperationURLParameter = { } }; -export const parameters15: OperationParameter = { +export const parameters20: OperationParameter = { parameterPath: "parameters", mapper: ResourceGuardProxyBaseResourceMapper }; -export const parameters16: OperationParameter = { +export const parameters21: OperationParameter = { parameterPath: "parameters", mapper: UnlockDeleteRequestMapper }; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/backupInstances.ts b/sdk/dataprotection/arm-dataprotection/src/operations/backupInstances.ts index 7600004ee5bb..ccaf94dc67c4 100644 --- a/sdk/dataprotection/arm-dataprotection/src/operations/backupInstances.ts +++ b/sdk/dataprotection/arm-dataprotection/src/operations/backupInstances.ts @@ -37,6 +37,12 @@ import { BackupInstancesValidateForBackupResponse, BackupInstancesGetBackupInstanceOperationResultOptionalParams, BackupInstancesGetBackupInstanceOperationResultResponse, + CrossRegionRestoreRequestObject, + BackupInstancesTriggerCrossRegionRestoreOptionalParams, + BackupInstancesTriggerCrossRegionRestoreResponse, + ValidateCrossRegionRestoreRequestObject, + BackupInstancesValidateCrossRegionRestoreOptionalParams, + BackupInstancesValidateCrossRegionRestoreResponse, AzureBackupRehydrationRequest, BackupInstancesTriggerRehydrateOptionalParams, BackupInstancesTriggerRehydrateResponse, @@ -448,7 +454,8 @@ export class BackupInstancesImpl implements BackupInstances { OperationState >(lro, { restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" }); await poller.poll(); return poller; @@ -546,7 +553,8 @@ export class BackupInstancesImpl implements BackupInstances { OperationState >(lro, { restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" }); await poller.poll(); return poller; @@ -601,6 +609,198 @@ export class BackupInstancesImpl implements BackupInstances { ); } + /** + * Triggers Cross Region Restore for BackupInstance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for trigger CRR operation + * @param options The options parameters. + */ + async beginTriggerCrossRegionRestore( + resourceGroupName: string, + location: string, + parameters: CrossRegionRestoreRequestObject, + options?: BackupInstancesTriggerCrossRegionRestoreOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + BackupInstancesTriggerCrossRegionRestoreResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, location, parameters, options }, + spec: triggerCrossRegionRestoreOperationSpec + }); + const poller = await createHttpPoller< + BackupInstancesTriggerCrossRegionRestoreResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Triggers Cross Region Restore for BackupInstance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for trigger CRR operation + * @param options The options parameters. + */ + async beginTriggerCrossRegionRestoreAndWait( + resourceGroupName: string, + location: string, + parameters: CrossRegionRestoreRequestObject, + options?: BackupInstancesTriggerCrossRegionRestoreOptionalParams + ): Promise { + const poller = await this.beginTriggerCrossRegionRestore( + resourceGroupName, + location, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Validates whether Cross Region Restore can be triggered for DataSource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginValidateCrossRegionRestore( + resourceGroupName: string, + location: string, + parameters: ValidateCrossRegionRestoreRequestObject, + options?: BackupInstancesValidateCrossRegionRestoreOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + BackupInstancesValidateCrossRegionRestoreResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, location, parameters, options }, + spec: validateCrossRegionRestoreOperationSpec + }); + const poller = await createHttpPoller< + BackupInstancesValidateCrossRegionRestoreResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Validates whether Cross Region Restore can be triggered for DataSource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginValidateCrossRegionRestoreAndWait( + resourceGroupName: string, + location: string, + parameters: ValidateCrossRegionRestoreRequestObject, + options?: BackupInstancesValidateCrossRegionRestoreOptionalParams + ): Promise { + const poller = await this.beginValidateCrossRegionRestore( + resourceGroupName, + location, + parameters, + options + ); + return poller.pollUntilDone(); + } + /** * rehydrate recovery point for restore for a BackupInstance * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -782,7 +982,8 @@ export class BackupInstancesImpl implements BackupInstances { OperationState >(lro, { restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" }); await poller.poll(); return poller; @@ -1338,7 +1539,8 @@ export class BackupInstancesImpl implements BackupInstances { OperationState >(lro, { restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" }); await poller.poll(); return poller; @@ -1586,6 +1788,72 @@ const getBackupInstanceOperationResultOperationSpec: coreClient.OperationSpec = headerParameters: [Parameters.accept], serializer }; +const triggerCrossRegionRestoreOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/crossRegionRestore", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 201: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 202: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 204: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters8, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.location1 + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const validateCrossRegionRestoreOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/validateCrossRegionRestore", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 201: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 202: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 204: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters9, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.location1 + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; const triggerRehydrateOperationSpec: coreClient.OperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate", @@ -1607,7 +1875,7 @@ const triggerRehydrateOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters8, + requestBody: Parameters.parameters10, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -1641,7 +1909,7 @@ const triggerRestoreOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters9, + requestBody: Parameters.parameters11, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -1763,7 +2031,7 @@ const syncBackupInstanceOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters10, + requestBody: Parameters.parameters12, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -1797,7 +2065,7 @@ const validateForRestoreOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters11, + requestBody: Parameters.parameters13, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/dppResourceGuardProxy.ts b/sdk/dataprotection/arm-dataprotection/src/operations/dppResourceGuardProxy.ts index 8e9f976587d8..598348800225 100644 --- a/sdk/dataprotection/arm-dataprotection/src/operations/dppResourceGuardProxy.ts +++ b/sdk/dataprotection/arm-dataprotection/src/operations/dppResourceGuardProxy.ts @@ -307,7 +307,7 @@ const createOrUpdateOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters15, + requestBody: Parameters.parameters20, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -354,7 +354,7 @@ const unlockDeleteOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters16, + requestBody: Parameters.parameters21, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/fetchCrossRegionRestoreJob.ts b/sdk/dataprotection/arm-dataprotection/src/operations/fetchCrossRegionRestoreJob.ts new file mode 100644 index 000000000000..de84f55b7282 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/fetchCrossRegionRestoreJob.ts @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { FetchCrossRegionRestoreJob } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { DataProtectionClient } from "../dataProtectionClient"; +import { + CrossRegionRestoreJobRequest, + FetchCrossRegionRestoreJobGetOptionalParams, + FetchCrossRegionRestoreJobGetResponse +} from "../models"; + +/** Class containing FetchCrossRegionRestoreJob operations. */ +export class FetchCrossRegionRestoreJobImpl + implements FetchCrossRegionRestoreJob { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class FetchCrossRegionRestoreJob class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Fetches the Cross Region Restore Job + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for operation + * @param options The options parameters. + */ + get( + resourceGroupName: string, + location: string, + parameters: CrossRegionRestoreJobRequest, + options?: FetchCrossRegionRestoreJobGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, location, parameters, options }, + getOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchCrossRegionRestoreJob", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.AzureBackupJobResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters15, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.location1 + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/fetchCrossRegionRestoreJobs.ts b/sdk/dataprotection/arm-dataprotection/src/operations/fetchCrossRegionRestoreJobs.ts new file mode 100644 index 000000000000..66dfe18c0dc6 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/fetchCrossRegionRestoreJobs.ts @@ -0,0 +1,220 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { FetchCrossRegionRestoreJobs } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { DataProtectionClient } from "../dataProtectionClient"; +import { + AzureBackupJobResource, + CrossRegionRestoreJobsRequest, + FetchCrossRegionRestoreJobsListNextOptionalParams, + FetchCrossRegionRestoreJobsListOptionalParams, + FetchCrossRegionRestoreJobsListResponse, + FetchCrossRegionRestoreJobsListNextResponse +} from "../models"; + +/// +/** Class containing FetchCrossRegionRestoreJobs operations. */ +export class FetchCrossRegionRestoreJobsImpl + implements FetchCrossRegionRestoreJobs { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class FetchCrossRegionRestoreJobs class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Fetches list of Cross Region Restore job belonging to the vault + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for operation + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + location: string, + parameters: CrossRegionRestoreJobsRequest, + options?: FetchCrossRegionRestoreJobsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + resourceGroupName, + location, + parameters, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + location, + parameters, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + location: string, + parameters: CrossRegionRestoreJobsRequest, + options?: FetchCrossRegionRestoreJobsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: FetchCrossRegionRestoreJobsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + resourceGroupName, + location, + parameters, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + location, + parameters, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + location: string, + parameters: CrossRegionRestoreJobsRequest, + options?: FetchCrossRegionRestoreJobsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + location, + parameters, + options + )) { + yield* page; + } + } + + /** + * Fetches list of Cross Region Restore job belonging to the vault + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for operation + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + location: string, + parameters: CrossRegionRestoreJobsRequest, + options?: FetchCrossRegionRestoreJobsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, location, parameters, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for operation + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + location: string, + parameters: CrossRegionRestoreJobsRequest, + nextLink: string, + options?: FetchCrossRegionRestoreJobsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, location, parameters, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchCrossRegionRestoreJobs", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.AzureBackupJobResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters16, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.location1 + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AzureBackupJobResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink, + Parameters.location1 + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/fetchSecondaryRecoveryPoints.ts b/sdk/dataprotection/arm-dataprotection/src/operations/fetchSecondaryRecoveryPoints.ts new file mode 100644 index 000000000000..d456fd13c541 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/fetchSecondaryRecoveryPoints.ts @@ -0,0 +1,226 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { FetchSecondaryRecoveryPoints } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { DataProtectionClient } from "../dataProtectionClient"; +import { + AzureBackupRecoveryPointResource, + FetchSecondaryRPsRequestParameters, + FetchSecondaryRecoveryPointsListNextOptionalParams, + FetchSecondaryRecoveryPointsListOptionalParams, + FetchSecondaryRecoveryPointsListResponse, + FetchSecondaryRecoveryPointsListNextResponse +} from "../models"; + +/// +/** Class containing FetchSecondaryRecoveryPoints operations. */ +export class FetchSecondaryRecoveryPointsImpl + implements FetchSecondaryRecoveryPoints { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class FetchSecondaryRecoveryPoints class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for Cross + * Region Restore. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for operation + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + location: string, + parameters: FetchSecondaryRPsRequestParameters, + options?: FetchSecondaryRecoveryPointsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + resourceGroupName, + location, + parameters, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + location, + parameters, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + location: string, + parameters: FetchSecondaryRPsRequestParameters, + options?: FetchSecondaryRecoveryPointsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: FetchSecondaryRecoveryPointsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + resourceGroupName, + location, + parameters, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + location, + parameters, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + location: string, + parameters: FetchSecondaryRPsRequestParameters, + options?: FetchSecondaryRecoveryPointsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + location, + parameters, + options + )) { + yield* page; + } + } + + /** + * Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for Cross + * Region Restore. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for operation + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + location: string, + parameters: FetchSecondaryRPsRequestParameters, + options?: FetchSecondaryRecoveryPointsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, location, parameters, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for operation + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + location: string, + parameters: FetchSecondaryRPsRequestParameters, + nextLink: string, + options?: FetchSecondaryRecoveryPointsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, location, parameters, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/fetchSecondaryRecoveryPoints", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.AzureBackupRecoveryPointResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters14, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.skipToken + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.location1 + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AzureBackupRecoveryPointResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink, + Parameters.location1 + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/index.ts b/sdk/dataprotection/arm-dataprotection/src/operations/index.ts index 7ec031af6618..b5b31a2158c5 100644 --- a/sdk/dataprotection/arm-dataprotection/src/operations/index.ts +++ b/sdk/dataprotection/arm-dataprotection/src/operations/index.ts @@ -17,6 +17,9 @@ export * from "./dataProtectionOperations"; export * from "./backupPolicies"; export * from "./backupInstances"; export * from "./recoveryPoints"; +export * from "./fetchSecondaryRecoveryPoints"; +export * from "./fetchCrossRegionRestoreJob"; +export * from "./fetchCrossRegionRestoreJobs"; export * from "./jobs"; export * from "./restorableTimeRanges"; export * from "./exportJobs"; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/resourceGuards.ts b/sdk/dataprotection/arm-dataprotection/src/operations/resourceGuards.ts index 0080aa6f333e..b8c6ac5d5d3d 100644 --- a/sdk/dataprotection/arm-dataprotection/src/operations/resourceGuards.ts +++ b/sdk/dataprotection/arm-dataprotection/src/operations/resourceGuards.ts @@ -1278,7 +1278,7 @@ const putOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters13, + requestBody: Parameters.parameters18, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -1345,7 +1345,7 @@ const patchOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters14, + requestBody: Parameters.parameters19, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/restorableTimeRanges.ts b/sdk/dataprotection/arm-dataprotection/src/operations/restorableTimeRanges.ts index 7611400ddec5..60a5d0e0eba0 100644 --- a/sdk/dataprotection/arm-dataprotection/src/operations/restorableTimeRanges.ts +++ b/sdk/dataprotection/arm-dataprotection/src/operations/restorableTimeRanges.ts @@ -64,7 +64,7 @@ const findOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters12, + requestBody: Parameters.parameters17, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupInstances.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupInstances.ts index 7f074eb60e10..7e5657026617 100644 --- a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupInstances.ts +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupInstances.ts @@ -24,6 +24,12 @@ import { BackupInstancesValidateForBackupResponse, BackupInstancesGetBackupInstanceOperationResultOptionalParams, BackupInstancesGetBackupInstanceOperationResultResponse, + CrossRegionRestoreRequestObject, + BackupInstancesTriggerCrossRegionRestoreOptionalParams, + BackupInstancesTriggerCrossRegionRestoreResponse, + ValidateCrossRegionRestoreRequestObject, + BackupInstancesValidateCrossRegionRestoreOptionalParams, + BackupInstancesValidateCrossRegionRestoreResponse, AzureBackupRehydrationRequest, BackupInstancesTriggerRehydrateOptionalParams, BackupInstancesTriggerRehydrateResponse, @@ -210,6 +216,68 @@ export interface BackupInstances { operationId: string, options?: BackupInstancesGetBackupInstanceOperationResultOptionalParams ): Promise; + /** + * Triggers Cross Region Restore for BackupInstance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for trigger CRR operation + * @param options The options parameters. + */ + beginTriggerCrossRegionRestore( + resourceGroupName: string, + location: string, + parameters: CrossRegionRestoreRequestObject, + options?: BackupInstancesTriggerCrossRegionRestoreOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + BackupInstancesTriggerCrossRegionRestoreResponse + > + >; + /** + * Triggers Cross Region Restore for BackupInstance. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for trigger CRR operation + * @param options The options parameters. + */ + beginTriggerCrossRegionRestoreAndWait( + resourceGroupName: string, + location: string, + parameters: CrossRegionRestoreRequestObject, + options?: BackupInstancesTriggerCrossRegionRestoreOptionalParams + ): Promise; + /** + * Validates whether Cross Region Restore can be triggered for DataSource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginValidateCrossRegionRestore( + resourceGroupName: string, + location: string, + parameters: ValidateCrossRegionRestoreRequestObject, + options?: BackupInstancesValidateCrossRegionRestoreOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + BackupInstancesValidateCrossRegionRestoreResponse + > + >; + /** + * Validates whether Cross Region Restore can be triggered for DataSource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginValidateCrossRegionRestoreAndWait( + resourceGroupName: string, + location: string, + parameters: ValidateCrossRegionRestoreRequestObject, + options?: BackupInstancesValidateCrossRegionRestoreOptionalParams + ): Promise; /** * rehydrate recovery point for restore for a BackupInstance * @param resourceGroupName The name of the resource group. The name is case insensitive. diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/fetchCrossRegionRestoreJob.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/fetchCrossRegionRestoreJob.ts new file mode 100644 index 000000000000..ab7669c61f1b --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/fetchCrossRegionRestoreJob.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + CrossRegionRestoreJobRequest, + FetchCrossRegionRestoreJobGetOptionalParams, + FetchCrossRegionRestoreJobGetResponse +} from "../models"; + +/** Interface representing a FetchCrossRegionRestoreJob. */ +export interface FetchCrossRegionRestoreJob { + /** + * Fetches the Cross Region Restore Job + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for operation + * @param options The options parameters. + */ + get( + resourceGroupName: string, + location: string, + parameters: CrossRegionRestoreJobRequest, + options?: FetchCrossRegionRestoreJobGetOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/fetchCrossRegionRestoreJobs.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/fetchCrossRegionRestoreJobs.ts new file mode 100644 index 000000000000..f7c66121d69d --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/fetchCrossRegionRestoreJobs.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + AzureBackupJobResource, + CrossRegionRestoreJobsRequest, + FetchCrossRegionRestoreJobsListOptionalParams +} from "../models"; + +/// +/** Interface representing a FetchCrossRegionRestoreJobs. */ +export interface FetchCrossRegionRestoreJobs { + /** + * Fetches list of Cross Region Restore job belonging to the vault + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for operation + * @param options The options parameters. + */ + list( + resourceGroupName: string, + location: string, + parameters: CrossRegionRestoreJobsRequest, + options?: FetchCrossRegionRestoreJobsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/fetchSecondaryRecoveryPoints.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/fetchSecondaryRecoveryPoints.ts new file mode 100644 index 000000000000..4ebe08b4b204 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/fetchSecondaryRecoveryPoints.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + AzureBackupRecoveryPointResource, + FetchSecondaryRPsRequestParameters, + FetchSecondaryRecoveryPointsListOptionalParams +} from "../models"; + +/// +/** Interface representing a FetchSecondaryRecoveryPoints. */ +export interface FetchSecondaryRecoveryPoints { + /** + * Returns a list of Secondary Recovery Points for a DataSource in a vault, that can be used for Cross + * Region Restore. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param location The name of the Azure region. + * @param parameters Request body for operation + * @param options The options parameters. + */ + list( + resourceGroupName: string, + location: string, + parameters: FetchSecondaryRPsRequestParameters, + options?: FetchSecondaryRecoveryPointsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/index.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/index.ts index 7ec031af6618..b5b31a2158c5 100644 --- a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/index.ts +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/index.ts @@ -17,6 +17,9 @@ export * from "./dataProtectionOperations"; export * from "./backupPolicies"; export * from "./backupInstances"; export * from "./recoveryPoints"; +export * from "./fetchSecondaryRecoveryPoints"; +export * from "./fetchCrossRegionRestoreJob"; +export * from "./fetchCrossRegionRestoreJobs"; export * from "./jobs"; export * from "./restorableTimeRanges"; export * from "./exportJobs"; diff --git a/sdk/dataprotection/arm-dataprotection/test/sampleTest.ts b/sdk/dataprotection/arm-dataprotection/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/dataprotection/arm-dataprotection/tsconfig.json b/sdk/dataprotection/arm-dataprotection/tsconfig.json index 1f65f09046a1..3e6ae96443f3 100644 --- a/sdk/dataprotection/arm-dataprotection/tsconfig.json +++ b/sdk/dataprotection/arm-dataprotection/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-dataprotection": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"