diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index cc5531f606f3..8b290e1797f0 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -71,6 +71,7 @@ specifiers: '@rush-temp/arm-datafactory': file:./projects/arm-datafactory.tgz '@rush-temp/arm-datalake-analytics': file:./projects/arm-datalake-analytics.tgz '@rush-temp/arm-datamigration': file:./projects/arm-datamigration.tgz + '@rush-temp/arm-dataprotection': file:./projects/arm-dataprotection.tgz '@rush-temp/arm-deploymentmanager': file:./projects/arm-deploymentmanager.tgz '@rush-temp/arm-desktopvirtualization': file:./projects/arm-desktopvirtualization.tgz '@rush-temp/arm-devcenter': file:./projects/arm-devcenter.tgz @@ -396,6 +397,7 @@ dependencies: '@rush-temp/arm-datafactory': file:projects/arm-datafactory.tgz '@rush-temp/arm-datalake-analytics': file:projects/arm-datalake-analytics.tgz '@rush-temp/arm-datamigration': file:projects/arm-datamigration.tgz + '@rush-temp/arm-dataprotection': file:projects/arm-dataprotection.tgz '@rush-temp/arm-deploymentmanager': file:projects/arm-deploymentmanager.tgz '@rush-temp/arm-desktopvirtualization': file:projects/arm-desktopvirtualization.tgz '@rush-temp/arm-devcenter': file:projects/arm-devcenter.tgz @@ -11556,6 +11558,34 @@ packages: - supports-color dev: false + file:projects/arm-dataprotection.tgz: + resolution: {integrity: sha512-mPqdYOFLOU2WIazS2uFxADHIPKAe7aVDE2ST912EX/nv/Ul06yfJhZuo+ZnblQHMM5C82mFVbxJ+MjBhLtO5Wg==, tarball: file:projects/arm-dataprotection.tgz} + name: '@rush-temp/arm-dataprotection' + version: 0.0.0 + dependencies: + '@azure/identity': 2.1.0 + '@microsoft/api-extractor': 7.34.2_@types+node@14.18.36 + '@rollup/plugin-commonjs': 21.1.0_rollup@2.79.1 + '@rollup/plugin-json': 4.1.0_rollup@2.79.1 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.1 + '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 + '@types/chai': 4.3.4 + '@types/node': 14.18.36 + chai: 4.3.7 + cross-env: 7.0.3 + dotenv: 8.6.0 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 2.79.1 + rollup-plugin-sourcemaps: 0.6.3_p2gydaekoyjvl5wd3ixslt7iq4 + tslib: 2.5.0 + typescript: 4.8.4 + uglify-js: 3.17.4 + transitivePeerDependencies: + - supports-color + dev: false + file:projects/arm-deploymentmanager.tgz: resolution: {integrity: sha512-DcgEP95P8+FhnDXHuN0MqNo9yPIBVXZZAz3vGRbZIck0DMof4EymCriyOpDe8uAxlxfL6JojzGhkyt50+xMYfw==, tarball: file:projects/arm-deploymentmanager.tgz} name: '@rush-temp/arm-deploymentmanager' diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index 75cb59b4ef72..4e35d7e3e98b 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -40,5 +40,5 @@ https://docs.microsoft.com/javascript/api/@azure/arm-loadtesting?view=azure-node https://docs.microsoft.com/javascript/api/@azure/arm-billingbenefits?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-billingbenefits https://docs.microsoft.com/javascript/api/@azure/arm-servicenetworking?view=azure-node-preview - +https://docs.microsoft.com/javascript/api/@azure/arm-dataprotection?view=azure-node-preview https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/testproxy/transition-scripts/generate-assets-json.ps1 diff --git a/rush.json b/rush.json index 1db6584385c5..7fa7ebf0894b 100644 --- a/rush.json +++ b/rush.json @@ -1,7 +1,7 @@ /** * This is the main configuration file for Rush. * For full documentation, please see https://rushjs.io - */{ + */ { "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json", /** * (Required) This specifies the version of the Rush engine to be used in this repo. @@ -1907,6 +1907,11 @@ "packageName": "@azure/arm-servicenetworking", "projectFolder": "sdk/servicenetworking/arm-servicenetworking", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-dataprotection", + "projectFolder": "sdk/dataprotection/arm-dataprotection", + "versionPolicyName": "management" } ] } diff --git a/sdk/dataprotection/arm-dataprotection/CHANGELOG.md b/sdk/dataprotection/arm-dataprotection/CHANGELOG.md new file mode 100644 index 000000000000..8bf9e4bbe64c --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-01-31) + +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/LICENSE b/sdk/dataprotection/arm-dataprotection/LICENSE new file mode 100644 index 000000000000..3a1d9b6f24f7 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2023 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/dataprotection/arm-dataprotection/README.md b/sdk/dataprotection/arm-dataprotection/README.md new file mode 100644 index 000000000000..b8dfaf89280d --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/README.md @@ -0,0 +1,109 @@ +# Azure Data Protection client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Data Protection client. + +Open API 2.0 Specs for Azure Data Protection service + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/dataprotection/arm-dataprotection) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-dataprotection) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-dataprotection?view=azure-node-preview) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-dataprotection` package + +Install the Azure Data Protection client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-dataprotection +``` + +### Create and authenticate a `DataProtectionClient` + +To create a client object to access the Azure Data Protection API, you will need the `endpoint` of your Azure Data Protection resource and a `credential`. The Azure Data Protection client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Data Protection resource in the [Azure Portal][azure_portal]. + +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure Data Protection** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. + +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new DataProtectionClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new DataProtectionClient(credential, subscriptionId); +``` + + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### DataProtectionClient + +`DataProtectionClient` is the primary interface for developers using the Azure Data Protection client library. Explore the methods on this client object to understand the different features of the Azure Data Protection service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fdataprotection%2Farm-dataprotection%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/dataprotection/arm-dataprotection/_meta.json b/sdk/dataprotection/arm-dataprotection/_meta.json new file mode 100644 index 000000000000..3d3f9d991588 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "13c5f0c89fa27c5ebcf23deba83dfb9265ded141", + "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=F:\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\dataprotection\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.7 --generate-sample=true", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.6.0", + "use": "@autorest/typescript@6.0.0-rc.7" +} \ No newline at end of file diff --git a/sdk/dataprotection/arm-dataprotection/api-extractor.json b/sdk/dataprotection/arm-dataprotection/api-extractor.json new file mode 100644 index 000000000000..54a9da9f3825 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/api-extractor.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-dataprotection.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } +} \ No newline at end of file diff --git a/sdk/dataprotection/arm-dataprotection/package.json b/sdk/dataprotection/arm-dataprotection/package.json new file mode 100644 index 000000000000..c26e6bc72baa --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/package.json @@ -0,0 +1,123 @@ +{ + "name": "@azure/arm-dataprotection", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for DataProtectionClient.", + "version": "1.0.0-beta.1", + "engines": { + "node": ">=14.0.0" + }, + "dependencies": { + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.6.1", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.8.0", + "tslib": "^2.2.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-dataprotection.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "@rollup/plugin-commonjs": "^21.0.1", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-multi-entry": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "mkdirp": "^1.0.4", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "typescript": "~4.8.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "dotenv": "^8.2.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", + "mocha": "^7.1.1", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@types/node": "^14.0.0", + "@azure/dev-tool": "^1.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "rollup.config.js", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "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", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/dataProtectionClient.ts", + "prefix": "packageDetails" + } + ] + }, + "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" + } +} \ No newline at end of file diff --git a/sdk/dataprotection/arm-dataprotection/recordings/node/dataprotection_test/recording_backupvaults_create_test.json b/sdk/dataprotection/arm-dataprotection/recordings/node/dataprotection_test/recording_backupvaults_create_test.json new file mode 100644 index 000000000000..0807466ade4d --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/recordings/node/dataprotection_test/recording_backupvaults_create_test.json @@ -0,0 +1,197 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DataProtection/backupVaults/swaggerExample?api-version=2022-11-01-preview", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "Content-Length": "252", + "Content-Type": "application/json", + "User-Agent": "azsdk-js-arm-dataprotection/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "3dc17a7e-03c5-48fb-a9bd-85ad68955cc2" + }, + "RequestBody": { + "identity": { + "type": "None" + }, + "location": "eastus", + "tags": { + "key1": "val1" + }, + "properties": { + "monitoringSettings": { + "azureMonitorAlertSettings": { + "alertsForAllJobFailures": "Enabled" + } + }, + "storageSettings": [ + { + "datastoreType": "VaultStore", + "type": "LocallyRedundant" + } + ] + } + }, + "StatusCode": 201, + "ResponseHeaders": { + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DataProtection/backupVaults/swaggerExample/operationStatus/NmFjMjBiMDQtODg0Yy00ZTM5LWJjZDEtNGIzZjUzZjIxN2YyOzgwNDUzOTViLTg2ODMtNDI3NC04MDEwLThiNTM1OTE5MDg1Mw==?api-version=2022-11-01-preview", + "Cache-Control": "no-cache", + "Content-Length": "617", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 06 Feb 2023 07:08:30 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Retry-After": "10", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-arm-resource-system-data": "{\u0022createdBy\u0022:\u0022azure_client_id\u0022,\u0022createdByType\u0022:\u0022Application\u0022,\u0022createdAt\u0022:\u00222023-02-06T07:08:26.6810227Z\u0022,\u0022lastModifiedBy\u0022:\u0022azure_client_id\u0022,\u0022lastModifiedByType\u0022:\u0022Application\u0022,\u0022lastModifiedAt\u0022:\u00222023-02-06T07:08:26.6810227Z\u0022}", + "x-ms-correlation-request-id": "0d01b654-aa90-4927-9e40-7a42915360af", + "x-ms-ratelimit-remaining-subscription-resource-requests": "99", + "x-ms-request-id": "0d01b654-aa90-4927-9e40-7a42915360af", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230206T070830Z:0d01b654-aa90-4927-9e40-7a42915360af" + }, + "ResponseBody": { + "location": "eastus", + "tags": { + "key1": "val1" + }, + "identity": { + "type": "None" + }, + "properties": { + "provisioningState": "Provisioning", + "storageSettings": [ + { + "datastoreType": "VaultStore", + "type": "LocallyRedundant" + } + ], + "isVaultProtectedByResourceGuard": false, + "monitoringSettings": { + "azureMonitorAlertSettings": { + "alertsForAllJobFailures": "Enabled" + } + }, + "securitySettings": { + "softDeleteSettings": { + "state": "On", + "retentionDurationInDays": 14.0 + } + } + }, + "id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DataProtection/backupVaults/swaggerExample", + "name": "swaggerExample", + "type": "Microsoft.DataProtection/backupVaults" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DataProtection/backupVaults/swaggerExample/operationStatus/NmFjMjBiMDQtODg0Yy00ZTM5LWJjZDEtNGIzZjUzZjIxN2YyOzgwNDUzOTViLTg2ODMtNDI3NC04MDEwLThiNTM1OTE5MDg1Mw==?api-version=2022-11-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "Content-Type": "application/json", + "User-Agent": "azsdk-js-arm-dataprotection/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "3785a790-ef62-4c21-853e-aeebcd23acfd" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 06 Feb 2023 07:08:31 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "e8a810b1-d803-444f-b18f-8caac66a8ff7", + "x-ms-ratelimit-remaining-subscription-resource-requests": "999", + "x-ms-request-id": "e8a810b1-d803-444f-b18f-8caac66a8ff7", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230206T070831Z:e8a810b1-d803-444f-b18f-8caac66a8ff7" + }, + "ResponseBody": { + "id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DataProtection/backupVaults/swaggerExample/operationStatus/NmFjMjBiMDQtODg0Yy00ZTM5LWJjZDEtNGIzZjUzZjIxN2YyOzgwNDUzOTViLTg2ODMtNDI3NC04MDEwLThiNTM1OTE5MDg1Mw==", + "name": "NmFjMjBiMDQtODg0Yy00ZTM5LWJjZDEtNGIzZjUzZjIxN2YyOzgwNDUzOTViLTg2ODMtNDI3NC04MDEwLThiNTM1OTE5MDg1Mw==", + "status": "Succeeded", + "startTime": "2023-02-06T07:08:27.9574336Z", + "endTime": "2023-02-06T07:08:28Z" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DataProtection/backupVaults/swaggerExample?api-version=2022-11-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "Content-Type": "application/json", + "User-Agent": "azsdk-js-arm-dataprotection/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "0de7a85d-7cf9-4d7f-97a8-b6b92c3b6faf" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 06 Feb 2023 07:08:32 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "8ab723cb-596b-4c33-a18d-669877b4c4de", + "x-ms-ratelimit-remaining-subscription-resource-requests": "499", + "x-ms-request-id": "8ab723cb-596b-4c33-a18d-669877b4c4de", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230206T070832Z:8ab723cb-596b-4c33-a18d-669877b4c4de" + }, + "ResponseBody": { + "location": "eastus", + "tags": { + "key1": "val1" + }, + "identity": { + "type": "None" + }, + "properties": { + "provisioningState": "Succeeded", + "storageSettings": [ + { + "datastoreType": "VaultStore", + "type": "LocallyRedundant" + } + ], + "isVaultProtectedByResourceGuard": false, + "monitoringSettings": { + "azureMonitorAlertSettings": { + "alertsForAllJobFailures": "Enabled" + } + }, + "securitySettings": { + "softDeleteSettings": { + "state": "On", + "retentionDurationInDays": 14.0 + } + } + }, + "id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DataProtection/backupVaults/swaggerExample", + "name": "swaggerExample", + "type": "Microsoft.DataProtection/backupVaults" + } + } + ], + "Variables": {} +} diff --git a/sdk/dataprotection/arm-dataprotection/recordings/node/dataprotection_test/recording_backupvaults_delete_test.json b/sdk/dataprotection/arm-dataprotection/recordings/node/dataprotection_test/recording_backupvaults_delete_test.json new file mode 100644 index 000000000000..8772fcfabac4 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/recordings/node/dataprotection_test/recording_backupvaults_delete_test.json @@ -0,0 +1,71 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DataProtection/backupVaults/swaggerExample?api-version=2022-11-01-preview", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-dataprotection/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "cfb4b495-f2cd-47ed-bd7a-a6a0317775fc" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DataProtection/locations/eastus/operationStatus/NmFjMjBiMDQtODg0Yy00ZTM5LWJjZDEtNGIzZjUzZjIxN2YyOzU3MWY4ZTY5LWQwNTItNDg0ZC04MTIwLWYwZTcyNzI1MmQ4NQ==?api-version=2022-11-01-preview", + "Cache-Control": "no-cache", + "Content-Length": "0", + "Date": "Mon, 06 Feb 2023 07:08:38 GMT", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.DataProtection/locations/eastus/operationResults/NmFjMjBiMDQtODg0Yy00ZTM5LWJjZDEtNGIzZjUzZjIxN2YyOzU3MWY4ZTY5LWQwNTItNDg0ZC04MTIwLWYwZTcyNzI1MmQ4NQ==?api-version=2022-11-01-preview", + "Pragma": "no-cache", + "Retry-After": "30", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "6b9943df-e961-41dd-b2ac-b2b54bb962eb", + "x-ms-ratelimit-remaining-subscription-resource-requests": "99", + "x-ms-request-id": "6b9943df-e961-41dd-b2ac-b2b54bb962eb", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230206T070838Z:6b9943df-e961-41dd-b2ac-b2b54bb962eb" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DataProtection/backupVaults?api-version=2022-11-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-dataprotection/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "58170afd-9a2c-4f4a-9f4a-3b2f0f507f73" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 06 Feb 2023 07:08:39 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "c389d155-539f-49ce-9f15-c6adc34b4785", + "x-ms-ratelimit-remaining-subscription-resource-requests": "496", + "x-ms-request-id": "c389d155-539f-49ce-9f15-c6adc34b4785", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230206T070839Z:c389d155-539f-49ce-9f15-c6adc34b4785" + }, + "ResponseBody": { + "value": [] + } + } + ], + "Variables": {} +} diff --git a/sdk/dataprotection/arm-dataprotection/recordings/node/dataprotection_test/recording_backupvaults_get_test.json b/sdk/dataprotection/arm-dataprotection/recordings/node/dataprotection_test/recording_backupvaults_get_test.json new file mode 100644 index 000000000000..f564bfd68994 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/recordings/node/dataprotection_test/recording_backupvaults_get_test.json @@ -0,0 +1,69 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DataProtection/backupVaults/swaggerExample?api-version=2022-11-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-dataprotection/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "994f0481-8d75-4abb-9fb9-6644addc82eb" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 06 Feb 2023 07:08:34 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "2140efe2-5333-4d80-9d61-3d4b78e44d54", + "x-ms-ratelimit-remaining-subscription-resource-requests": "498", + "x-ms-request-id": "2140efe2-5333-4d80-9d61-3d4b78e44d54", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230206T070834Z:2140efe2-5333-4d80-9d61-3d4b78e44d54" + }, + "ResponseBody": { + "location": "eastus", + "tags": { + "key1": "val1" + }, + "identity": { + "type": "None" + }, + "properties": { + "provisioningState": "Succeeded", + "storageSettings": [ + { + "datastoreType": "VaultStore", + "type": "LocallyRedundant" + } + ], + "isVaultProtectedByResourceGuard": false, + "monitoringSettings": { + "azureMonitorAlertSettings": { + "alertsForAllJobFailures": "Enabled" + } + }, + "securitySettings": { + "softDeleteSettings": { + "state": "On", + "retentionDurationInDays": 14.0 + } + } + }, + "id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DataProtection/backupVaults/swaggerExample", + "name": "swaggerExample", + "type": "Microsoft.DataProtection/backupVaults" + } + } + ], + "Variables": {} +} diff --git a/sdk/dataprotection/arm-dataprotection/recordings/node/dataprotection_test/recording_backupvaults_list_test.json b/sdk/dataprotection/arm-dataprotection/recordings/node/dataprotection_test/recording_backupvaults_list_test.json new file mode 100644 index 000000000000..17896c0a048e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/recordings/node/dataprotection_test/recording_backupvaults_list_test.json @@ -0,0 +1,73 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DataProtection/backupVaults?api-version=2022-11-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-dataprotection/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "55484f68-4b4b-4d83-bb74-656b3c1f67d7" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 06 Feb 2023 07:08:35 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Server": "Kestrel", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "9b81406e-a74f-4dd5-9c84-4fc244b8b3e8", + "x-ms-ratelimit-remaining-subscription-resource-requests": "497", + "x-ms-request-id": "9b81406e-a74f-4dd5-9c84-4fc244b8b3e8", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230206T070835Z:9b81406e-a74f-4dd5-9c84-4fc244b8b3e8" + }, + "ResponseBody": { + "value": [ + { + "location": "eastus", + "tags": { + "key1": "val1" + }, + "identity": { + "type": "None" + }, + "properties": { + "provisioningState": "Succeeded", + "storageSettings": [ + { + "datastoreType": "VaultStore", + "type": "LocallyRedundant" + } + ], + "isVaultProtectedByResourceGuard": false, + "monitoringSettings": { + "azureMonitorAlertSettings": { + "alertsForAllJobFailures": "Enabled" + } + }, + "securitySettings": { + "softDeleteSettings": { + "state": "On", + "retentionDurationInDays": 14.0 + } + } + }, + "id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.DataProtection/backupVaults/swaggerExample", + "name": "swaggerExample", + "type": "Microsoft.DataProtection/backupVaults" + } + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/dataprotection/arm-dataprotection/review/arm-dataprotection.api.md b/sdk/dataprotection/arm-dataprotection/review/arm-dataprotection.api.md new file mode 100644 index 000000000000..ddcd1932671d --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/review/arm-dataprotection.api.md @@ -0,0 +1,2381 @@ +## API Report File for "@azure/arm-dataprotection" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public +export interface AbsoluteDeleteOption extends DeleteOption { + objectType: "AbsoluteDeleteOption"; +} + +// @public +export type AbsoluteMarker = string; + +// @public +export interface AdHocBackupRuleOptions { + // (undocumented) + ruleName: string; + triggerOption: AdhocBackupTriggerOption; +} + +// @public +export interface AdhocBackupTriggerOption { + // (undocumented) + retentionTagOverride?: string; +} + +// @public +export interface AdhocBasedTaggingCriteria { + tagInfo?: RetentionTag; +} + +// @public +export interface AdhocBasedTriggerContext extends TriggerContext { + objectType: "AdhocBasedTriggerContext"; + taggingCriteria: AdhocBasedTaggingCriteria; +} + +// @public +export type AlertsState = string; + +// @public +export interface AuthCredentials { + objectType: "SecretStoreBasedAuthCredentials"; +} + +// @public (undocumented) +export type AuthCredentialsUnion = AuthCredentials | SecretStoreBasedAuthCredentials; + +// @public +export interface AzureBackupDiscreteRecoveryPoint extends AzureBackupRecoveryPoint { + // (undocumented) + friendlyName?: string; + objectType: "AzureBackupDiscreteRecoveryPoint"; + // (undocumented) + policyName?: string; + // (undocumented) + policyVersion?: string; + // (undocumented) + recoveryPointDataStoresDetails?: RecoveryPointDataStoreDetails[]; + // (undocumented) + recoveryPointId?: string; + // (undocumented) + recoveryPointTime: Date; + // (undocumented) + recoveryPointType?: string; + // (undocumented) + retentionTagName?: string; + // (undocumented) + retentionTagVersion?: string; +} + +// @public +export interface AzureBackupFindRestorableTimeRangesRequest { + endTime?: string; + sourceDataStoreType: RestoreSourceDataStoreType; + startTime?: string; +} + +// @public +export interface AzureBackupFindRestorableTimeRangesRequestResource extends DppWorkerRequest { + content?: AzureBackupFindRestorableTimeRangesRequest; +} + +// @public +export interface AzureBackupFindRestorableTimeRangesResponse { + // (undocumented) + objectType?: string; + restorableTimeRanges?: RestorableTimeRange[]; +} + +// @public +export interface AzureBackupFindRestorableTimeRangesResponseResource extends DppResource { + properties?: AzureBackupFindRestorableTimeRangesResponse; +} + +// @public +export interface AzureBackupJob { + activityID: string; + backupInstanceFriendlyName: string; + readonly backupInstanceId?: string; + dataSourceId: string; + dataSourceLocation: string; + dataSourceName: string; + dataSourceSetName?: string; + dataSourceType: string; + // (undocumented) + destinationDataStoreName?: string; + duration?: string; + readonly endTime?: Date; + readonly errorDetails?: UserFacingError[]; + // (undocumented) + etag?: string; + readonly extendedInfo?: JobExtendedInfo; + isUserTriggered: boolean; + operation: string; + operationCategory: string; + readonly policyId?: string; + readonly policyName?: string; + progressEnabled: boolean; + readonly progressUrl?: string; + readonly restoreType?: string; + // (undocumented) + sourceDataStoreName?: string; + sourceResourceGroup: string; + sourceSubscriptionID: string; + startTime: Date; + status: string; + subscriptionId: string; + supportedActions: string[]; + vaultName: string; +} + +// @public +export interface AzureBackupJobResource extends DppResource { + properties?: AzureBackupJob; +} + +// @public +export interface AzureBackupJobResourceList extends DppResourceList { + value?: AzureBackupJobResource[]; +} + +// @public +export interface AzureBackupParams extends BackupParameters { + backupType: string; + objectType: "AzureBackupParams"; +} + +// @public +export interface AzureBackupRecoveryPoint { + objectType: "AzureBackupDiscreteRecoveryPoint"; +} + +// @public +export interface AzureBackupRecoveryPointBasedRestoreRequest extends AzureBackupRestoreRequest { + objectType: "AzureBackupRecoveryPointBasedRestoreRequest" | "AzureBackupRestoreWithRehydrationRequest"; + // (undocumented) + recoveryPointId: string; +} + +// @public (undocumented) +export type AzureBackupRecoveryPointBasedRestoreRequestUnion = AzureBackupRecoveryPointBasedRestoreRequest | AzureBackupRestoreWithRehydrationRequest; + +// @public +export interface AzureBackupRecoveryPointResource extends DppResource { + properties?: AzureBackupRecoveryPointUnion; +} + +// @public +export interface AzureBackupRecoveryPointResourceList extends DppResourceList { + value?: AzureBackupRecoveryPointResource[]; +} + +// @public (undocumented) +export type AzureBackupRecoveryPointUnion = AzureBackupRecoveryPoint | AzureBackupDiscreteRecoveryPoint; + +// @public +export interface AzureBackupRecoveryTimeBasedRestoreRequest extends AzureBackupRestoreRequest { + objectType: "AzureBackupRecoveryTimeBasedRestoreRequest"; + recoveryPointTime: string; +} + +// @public +export interface AzureBackupRehydrationRequest { + recoveryPointId: string; + rehydrationPriority?: RehydrationPriority; + rehydrationRetentionDuration: string; +} + +// @public +export interface AzureBackupRestoreRequest { + objectType: "AzureBackupRecoveryPointBasedRestoreRequest" | "AzureBackupRestoreWithRehydrationRequest" | "AzureBackupRecoveryTimeBasedRestoreRequest"; + restoreTargetInfo: RestoreTargetInfoBaseUnion; + sourceDataStoreType: SourceDataStoreType; + sourceResourceId?: string; +} + +// @public (undocumented) +export type AzureBackupRestoreRequestUnion = AzureBackupRestoreRequest | AzureBackupRecoveryPointBasedRestoreRequestUnion | AzureBackupRecoveryTimeBasedRestoreRequest; + +// @public +export interface AzureBackupRestoreWithRehydrationRequest extends AzureBackupRecoveryPointBasedRestoreRequest { + objectType: "AzureBackupRestoreWithRehydrationRequest"; + rehydrationPriority: RehydrationPriority; + rehydrationRetentionDuration: string; +} + +// @public +export interface AzureBackupRule extends BasePolicyRule { + backupParameters?: BackupParametersUnion; + dataStore: DataStoreInfoBase; + objectType: "AzureBackupRule"; + trigger: TriggerContextUnion; +} + +// @public +export interface AzureMonitorAlertSettings { + // (undocumented) + alertsForAllJobFailures?: AlertsState; +} + +// @public +export interface AzureOperationalStoreParameters extends DataStoreParameters { + objectType: "AzureOperationalStoreParameters"; + resourceGroupId?: string; +} + +// @public +export interface AzureRetentionRule extends BasePolicyRule { + // (undocumented) + isDefault?: boolean; + // (undocumented) + lifecycles: SourceLifeCycle[]; + objectType: "AzureRetentionRule"; +} + +// @public +export interface BackupCriteria { + objectType: "ScheduleBasedBackupCriteria"; +} + +// @public (undocumented) +export type BackupCriteriaUnion = BackupCriteria | ScheduleBasedBackupCriteria; + +// @public +export interface BackupDatasourceParameters { + objectType: "KubernetesClusterBackupDatasourceParameters" | "BlobBackupDatasourceParameters"; +} + +// @public (undocumented) +export type BackupDatasourceParametersUnion = BackupDatasourceParameters | KubernetesClusterBackupDatasourceParameters | BlobBackupDatasourceParameters; + +// @public +export interface BackupInstance { + readonly currentProtectionState?: CurrentProtectionState; + datasourceAuthCredentials?: AuthCredentialsUnion; + dataSourceInfo: Datasource; + dataSourceSetInfo?: DatasourceSet; + friendlyName?: string; + // (undocumented) + objectType: string; + policyInfo: PolicyInfo; + readonly protectionErrorDetails?: UserFacingError; + readonly protectionStatus?: ProtectionStatusDetails; + readonly provisioningState?: string; + validationType?: ValidationType; +} + +// @public +export interface BackupInstanceResource extends DppProxyResource { + properties?: BackupInstance; +} + +// @public +export interface BackupInstanceResourceList extends DppResourceList { + value?: BackupInstanceResource[]; +} + +// @public +export interface BackupInstances { + beginAdhocBackup(resourceGroupName: string, vaultName: string, backupInstanceName: string, parameters: TriggerBackupRequest, options?: BackupInstancesAdhocBackupOptionalParams): Promise, BackupInstancesAdhocBackupResponse>>; + beginAdhocBackupAndWait(resourceGroupName: string, vaultName: string, backupInstanceName: string, parameters: TriggerBackupRequest, options?: BackupInstancesAdhocBackupOptionalParams): Promise; + beginCreateOrUpdate(resourceGroupName: string, vaultName: string, backupInstanceName: string, parameters: BackupInstanceResource, options?: BackupInstancesCreateOrUpdateOptionalParams): Promise, BackupInstancesCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, vaultName: string, backupInstanceName: string, parameters: BackupInstanceResource, options?: BackupInstancesCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, vaultName: string, backupInstanceName: string, options?: BackupInstancesDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, vaultName: string, backupInstanceName: string, options?: BackupInstancesDeleteOptionalParams): Promise; + beginResumeBackups(resourceGroupName: string, vaultName: string, backupInstanceName: string, options?: BackupInstancesResumeBackupsOptionalParams): Promise, void>>; + beginResumeBackupsAndWait(resourceGroupName: string, vaultName: string, backupInstanceName: string, options?: BackupInstancesResumeBackupsOptionalParams): Promise; + beginResumeProtection(resourceGroupName: string, vaultName: string, backupInstanceName: string, options?: BackupInstancesResumeProtectionOptionalParams): Promise, void>>; + beginResumeProtectionAndWait(resourceGroupName: string, vaultName: string, backupInstanceName: string, options?: BackupInstancesResumeProtectionOptionalParams): Promise; + beginStopProtection(resourceGroupName: string, vaultName: string, backupInstanceName: string, options?: BackupInstancesStopProtectionOptionalParams): Promise, void>>; + beginStopProtectionAndWait(resourceGroupName: string, vaultName: string, backupInstanceName: string, options?: BackupInstancesStopProtectionOptionalParams): Promise; + beginSuspendBackups(resourceGroupName: string, vaultName: string, backupInstanceName: string, options?: BackupInstancesSuspendBackupsOptionalParams): Promise, void>>; + 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; + 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; + 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>>; + beginValidateForRestoreAndWait(resourceGroupName: string, vaultName: string, backupInstanceName: string, parameters: ValidateRestoreRequestObject, options?: BackupInstancesValidateForRestoreOptionalParams): Promise; + get(resourceGroupName: string, vaultName: string, backupInstanceName: string, options?: BackupInstancesGetOptionalParams): Promise; + getBackupInstanceOperationResult(resourceGroupName: string, vaultName: string, backupInstanceName: string, operationId: string, options?: BackupInstancesGetBackupInstanceOperationResultOptionalParams): Promise; + list(resourceGroupName: string, vaultName: string, options?: BackupInstancesListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface BackupInstancesAdhocBackupHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface BackupInstancesAdhocBackupOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type BackupInstancesAdhocBackupResponse = OperationJobExtendedInfo; + +// @public +export interface BackupInstancesCreateOrUpdateHeaders { + azureAsyncOperation?: string; + location?: string; +} + +// @public +export interface BackupInstancesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type BackupInstancesCreateOrUpdateResponse = BackupInstanceResource; + +// @public +export interface BackupInstancesDeleteHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface BackupInstancesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface BackupInstancesExtensionRouting { + list(resourceId: string, options?: BackupInstancesExtensionRoutingListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface BackupInstancesExtensionRoutingListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupInstancesExtensionRoutingListNextResponse = BackupInstanceResourceList; + +// @public +export interface BackupInstancesExtensionRoutingListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupInstancesExtensionRoutingListResponse = BackupInstanceResourceList; + +// @public +export interface BackupInstancesGetBackupInstanceOperationResultOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupInstancesGetBackupInstanceOperationResultResponse = BackupInstanceResource; + +// @public +export interface BackupInstancesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupInstancesGetResponse = BackupInstanceResource; + +// @public +export interface BackupInstancesListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupInstancesListNextResponse = BackupInstanceResourceList; + +// @public +export interface BackupInstancesListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupInstancesListResponse = BackupInstanceResourceList; + +// @public +export interface BackupInstancesResumeBackupsHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface BackupInstancesResumeBackupsOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface BackupInstancesResumeProtectionHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface BackupInstancesResumeProtectionOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface BackupInstancesStopProtectionHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface BackupInstancesStopProtectionOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface BackupInstancesSuspendBackupsHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface BackupInstancesSuspendBackupsOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface BackupInstancesSyncBackupInstanceHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface BackupInstancesSyncBackupInstanceOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface BackupInstancesTriggerRehydrateHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface BackupInstancesTriggerRehydrateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type BackupInstancesTriggerRehydrateResponse = BackupInstancesTriggerRehydrateHeaders; + +// @public +export interface BackupInstancesTriggerRestoreHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface BackupInstancesTriggerRestoreOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type BackupInstancesTriggerRestoreResponse = OperationJobExtendedInfo; + +// @public +export interface BackupInstancesValidateForBackupHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface BackupInstancesValidateForBackupOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type BackupInstancesValidateForBackupResponse = OperationJobExtendedInfo; + +// @public +export interface BackupInstancesValidateForRestoreHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface BackupInstancesValidateForRestoreOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type BackupInstancesValidateForRestoreResponse = OperationJobExtendedInfo; + +// @public +export interface BackupParameters { + objectType: "AzureBackupParams"; +} + +// @public (undocumented) +export type BackupParametersUnion = BackupParameters | AzureBackupParams; + +// @public +export interface BackupPolicies { + createOrUpdate(resourceGroupName: string, vaultName: string, backupPolicyName: string, parameters: BaseBackupPolicyResource, options?: BackupPoliciesCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, vaultName: string, backupPolicyName: string, options?: BackupPoliciesDeleteOptionalParams): Promise; + get(resourceGroupName: string, vaultName: string, backupPolicyName: string, options?: BackupPoliciesGetOptionalParams): Promise; + list(resourceGroupName: string, vaultName: string, options?: BackupPoliciesListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface BackupPoliciesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupPoliciesCreateOrUpdateResponse = BaseBackupPolicyResource; + +// @public +export interface BackupPoliciesDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface BackupPoliciesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupPoliciesGetResponse = BaseBackupPolicyResource; + +// @public +export interface BackupPoliciesListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupPoliciesListNextResponse = BaseBackupPolicyResourceList; + +// @public +export interface BackupPoliciesListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupPoliciesListResponse = BaseBackupPolicyResourceList; + +// @public +export interface BackupPolicy extends BaseBackupPolicy { + objectType: "BackupPolicy"; + policyRules: BasePolicyRuleUnion[]; +} + +// @public +export interface BackupSchedule { + repeatingTimeIntervals: string[]; + timeZone?: string; +} + +// @public +export interface BackupVault { + readonly isVaultProtectedByResourceGuard?: boolean; + monitoringSettings?: MonitoringSettings; + readonly provisioningState?: ProvisioningState; + readonly resourceMoveDetails?: ResourceMoveDetails; + readonly resourceMoveState?: ResourceMoveState; + securitySettings?: SecuritySettings; + storageSettings: StorageSetting[]; +} + +// @public +export interface BackupVaultOperationResults { + // (undocumented) + get(resourceGroupName: string, vaultName: string, operationId: string, options?: BackupVaultOperationResultsGetOptionalParams): Promise; +} + +// @public +export interface BackupVaultOperationResultsGetHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface BackupVaultOperationResultsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupVaultOperationResultsGetResponse = BackupVaultResource; + +// @public +export interface BackupVaultResource extends DppTrackedResource { + properties: BackupVault; +} + +// @public +export interface BackupVaultResourceList extends DppResourceList { + value?: BackupVaultResource[]; +} + +// @public +export interface BackupVaults { + beginCreateOrUpdate(resourceGroupName: string, vaultName: string, parameters: BackupVaultResource, options?: BackupVaultsCreateOrUpdateOptionalParams): Promise, BackupVaultsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, vaultName: string, parameters: BackupVaultResource, options?: BackupVaultsCreateOrUpdateOptionalParams): Promise; + beginUpdate(resourceGroupName: string, vaultName: string, parameters: PatchResourceRequestInput, options?: BackupVaultsUpdateOptionalParams): Promise, BackupVaultsUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, vaultName: string, parameters: PatchResourceRequestInput, options?: BackupVaultsUpdateOptionalParams): Promise; + checkNameAvailability(resourceGroupName: string, location: string, parameters: CheckNameAvailabilityRequest, options?: BackupVaultsCheckNameAvailabilityOptionalParams): Promise; + delete(resourceGroupName: string, vaultName: string, options?: BackupVaultsDeleteOptionalParams): Promise; + get(resourceGroupName: string, vaultName: string, options?: BackupVaultsGetOptionalParams): Promise; + listInResourceGroup(resourceGroupName: string, options?: BackupVaultsGetInResourceGroupOptionalParams): PagedAsyncIterableIterator; + listInSubscription(options?: BackupVaultsGetInSubscriptionOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface BackupVaultsCheckNameAvailabilityOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupVaultsCheckNameAvailabilityResponse = CheckNameAvailabilityResult; + +// @public +export interface BackupVaultsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type BackupVaultsCreateOrUpdateResponse = BackupVaultResource; + +// @public +export interface BackupVaultsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface BackupVaultsGetInResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupVaultsGetInResourceGroupNextResponse = BackupVaultResourceList; + +// @public +export interface BackupVaultsGetInResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupVaultsGetInResourceGroupResponse = BackupVaultResourceList; + +// @public +export interface BackupVaultsGetInSubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupVaultsGetInSubscriptionNextResponse = BackupVaultResourceList; + +// @public +export interface BackupVaultsGetInSubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupVaultsGetInSubscriptionResponse = BackupVaultResourceList; + +// @public +export interface BackupVaultsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type BackupVaultsGetResponse = BackupVaultResource; + +// @public +export interface BackupVaultsUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type BackupVaultsUpdateResponse = BackupVaultResource; + +// @public +export interface BaseBackupPolicy { + datasourceTypes: string[]; + objectType: "BackupPolicy"; +} + +// @public +export interface BaseBackupPolicyResource extends DppResource { + properties?: BaseBackupPolicyUnion; +} + +// @public +export interface BaseBackupPolicyResourceList extends DppResourceList { + value?: BaseBackupPolicyResource[]; +} + +// @public (undocumented) +export type BaseBackupPolicyUnion = BaseBackupPolicy | BackupPolicy; + +// @public +export interface BasePolicyRule { + // (undocumented) + name: string; + objectType: "AzureBackupRule" | "AzureRetentionRule"; +} + +// @public (undocumented) +export type BasePolicyRuleUnion = BasePolicyRule | AzureBackupRule | AzureRetentionRule; + +// @public +export interface BlobBackupDatasourceParameters extends BackupDatasourceParameters { + containersList: string[]; + objectType: "BlobBackupDatasourceParameters"; +} + +// @public +export interface CheckNameAvailabilityRequest { + name?: string; + type?: string; +} + +// @public +export interface CheckNameAvailabilityResult { + message?: string; + nameAvailable?: boolean; + reason?: string; +} + +// @public +export interface ClientDiscoveryDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface ClientDiscoveryForLogSpecification { + blobDuration?: string; + displayName?: string; + name?: string; +} + +// @public +export interface ClientDiscoveryForProperties { + serviceSpecification?: ClientDiscoveryForServiceSpecification; +} + +// @public +export interface ClientDiscoveryForServiceSpecification { + logSpecifications?: ClientDiscoveryForLogSpecification[]; +} + +// @public +export interface ClientDiscoveryResponse { + nextLink?: string; + value?: ClientDiscoveryValueForSingleApi[]; +} + +// @public +export interface ClientDiscoveryValueForSingleApi { + display?: ClientDiscoveryDisplay; + isDataAction?: boolean; + name?: string; + origin?: string; + properties?: ClientDiscoveryForProperties; +} + +// @public +export interface CloudError { + error?: ErrorModel; +} + +// @public +export interface CopyOnExpiryOption extends CopyOption { + objectType: "CopyOnExpiryOption"; +} + +// @public +export interface CopyOption { + objectType: "CopyOnExpiryOption" | "CustomCopyOption" | "ImmediateCopyOption"; +} + +// @public (undocumented) +export type CopyOptionUnion = CopyOption | CopyOnExpiryOption | CustomCopyOption | ImmediateCopyOption; + +// @public +export type CreatedByType = string; + +// @public +export type CurrentProtectionState = string; + +// @public +export interface CustomCopyOption extends CopyOption { + duration?: string; + objectType: "CustomCopyOption"; +} + +// @public +export interface DataProtection { + checkFeatureSupport(location: string, parameters: FeatureValidationRequestBaseUnion, options?: DataProtectionCheckFeatureSupportOptionalParams): Promise; +} + +// @public +export interface DataProtectionCheckFeatureSupportOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DataProtectionCheckFeatureSupportResponse = FeatureValidationResponseBaseUnion; + +// @public (undocumented) +export class DataProtectionClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: DataProtectionClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + backupInstances: BackupInstances; + // (undocumented) + backupInstancesExtensionRouting: BackupInstancesExtensionRouting; + // (undocumented) + backupPolicies: BackupPolicies; + // (undocumented) + backupVaultOperationResults: BackupVaultOperationResults; + // (undocumented) + backupVaults: BackupVaults; + // (undocumented) + dataProtection: DataProtection; + // (undocumented) + dataProtectionOperations: DataProtectionOperations; + // (undocumented) + deletedBackupInstances: DeletedBackupInstances; + // (undocumented) + dppResourceGuardProxy: DppResourceGuardProxy; + // (undocumented) + exportJobs: ExportJobs; + // (undocumented) + exportJobsOperationResult: ExportJobsOperationResult; + // (undocumented) + jobs: Jobs; + // (undocumented) + operationResult: OperationResult; + // (undocumented) + operationStatus: OperationStatus; + // (undocumented) + operationStatusBackupVaultContext: OperationStatusBackupVaultContext; + // (undocumented) + operationStatusResourceGroupContext: OperationStatusResourceGroupContext; + // (undocumented) + recoveryPoints: RecoveryPoints; + // (undocumented) + resourceGuards: ResourceGuards; + // (undocumented) + restorableTimeRanges: RestorableTimeRanges; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface DataProtectionClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface DataProtectionOperations { + list(options?: DataProtectionOperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface DataProtectionOperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DataProtectionOperationsListNextResponse = ClientDiscoveryResponse; + +// @public +export interface DataProtectionOperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DataProtectionOperationsListResponse = ClientDiscoveryResponse; + +// @public +export interface Datasource { + datasourceType?: string; + objectType?: string; + resourceID: string; + resourceLocation?: string; + resourceName?: string; + resourceType?: string; + resourceUri?: string; +} + +// @public +export interface DatasourceSet { + datasourceType?: string; + objectType?: string; + resourceID: string; + resourceLocation?: string; + resourceName?: string; + resourceType?: string; + resourceUri?: string; +} + +// @public +export interface DataStoreInfoBase { + dataStoreType: DataStoreTypes; + objectType: string; +} + +// @public +export interface DataStoreParameters { + dataStoreType: DataStoreTypes; + objectType: "AzureOperationalStoreParameters"; +} + +// @public (undocumented) +export type DataStoreParametersUnion = DataStoreParameters | AzureOperationalStoreParameters; + +// @public +export type DataStoreTypes = string; + +// @public +export interface Day { + date?: number; + isLast?: boolean; +} + +// @public +export type DayOfWeek = string; + +// @public +export interface DeletedBackupInstance extends BackupInstance { + readonly deletionInfo?: DeletionInfo; +} + +// @public +export interface DeletedBackupInstanceResource extends DppResource { + properties?: DeletedBackupInstance; +} + +// @public +export interface DeletedBackupInstanceResourceList extends DppResourceList { + value?: DeletedBackupInstanceResource[]; +} + +// @public +export interface DeletedBackupInstances { + // (undocumented) + beginUndelete(resourceGroupName: string, vaultName: string, backupInstanceName: string, options?: DeletedBackupInstancesUndeleteOptionalParams): Promise, void>>; + // (undocumented) + beginUndeleteAndWait(resourceGroupName: string, vaultName: string, backupInstanceName: string, options?: DeletedBackupInstancesUndeleteOptionalParams): Promise; + get(resourceGroupName: string, vaultName: string, backupInstanceName: string, options?: DeletedBackupInstancesGetOptionalParams): Promise; + list(resourceGroupName: string, vaultName: string, options?: DeletedBackupInstancesListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface DeletedBackupInstancesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeletedBackupInstancesGetResponse = DeletedBackupInstanceResource; + +// @public +export interface DeletedBackupInstancesListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeletedBackupInstancesListNextResponse = DeletedBackupInstanceResourceList; + +// @public +export interface DeletedBackupInstancesListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeletedBackupInstancesListResponse = DeletedBackupInstanceResourceList; + +// @public +export interface DeletedBackupInstancesUndeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface DeleteOption { + duration: string; + objectType: "AbsoluteDeleteOption"; +} + +// @public (undocumented) +export type DeleteOptionUnion = DeleteOption | AbsoluteDeleteOption; + +// @public +export interface DeletionInfo { + readonly billingEndDate?: string; + readonly deleteActivityID?: string; + readonly deletionTime?: string; + readonly scheduledPurgeTime?: string; +} + +// @public +export interface DppBaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +// @public +export interface DppBaseResourceList { + nextLink?: string; + value?: DppBaseResource[]; +} + +// @public +export interface DppIdentityDetails { + readonly principalId?: string; + readonly tenantId?: string; + type?: string; +} + +// @public (undocumented) +export interface DppProxyResource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + tags?: { + [propertyName: string]: string; + }; + readonly type?: string; +} + +// @public +export interface DppResource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface DppResourceGuardProxy { + // (undocumented) + delete(resourceGroupName: string, vaultName: string, resourceGuardProxyName: string, options?: DppResourceGuardProxyDeleteOptionalParams): Promise; + // (undocumented) + get(resourceGroupName: string, vaultName: string, resourceGuardProxyName: string, options?: DppResourceGuardProxyGetOptionalParams): Promise; + // (undocumented) + list(resourceGroupName: string, vaultName: string, options?: DppResourceGuardProxyListOptionalParams): PagedAsyncIterableIterator; + // (undocumented) + put(resourceGroupName: string, vaultName: string, resourceGuardProxyName: string, parameters: ResourceGuardProxyBaseResource, options?: DppResourceGuardProxyPutOptionalParams): Promise; + // (undocumented) + unlockDelete(resourceGroupName: string, vaultName: string, resourceGuardProxyName: string, parameters: UnlockDeleteRequest, options?: DppResourceGuardProxyUnlockDeleteOptionalParams): Promise; +} + +// @public +export interface DppResourceGuardProxyDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface DppResourceGuardProxyGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DppResourceGuardProxyGetResponse = ResourceGuardProxyBaseResource; + +// @public +export interface DppResourceGuardProxyListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DppResourceGuardProxyListNextResponse = ResourceGuardProxyBaseResourceList; + +// @public +export interface DppResourceGuardProxyListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DppResourceGuardProxyListResponse = ResourceGuardProxyBaseResourceList; + +// @public +export interface DppResourceGuardProxyPutOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DppResourceGuardProxyPutResponse = ResourceGuardProxyBaseResource; + +// @public +export interface DppResourceGuardProxyUnlockDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DppResourceGuardProxyUnlockDeleteResponse = UnlockDeleteResponse; + +// @public +export interface DppResourceList { + nextLink?: string; +} + +// @public (undocumented) +export interface DppTrackedResource { + eTag?: string; + readonly id?: string; + identity?: DppIdentityDetails; + location?: string; + readonly name?: string; + readonly systemData?: SystemData; + tags?: { + [propertyName: string]: string; + }; + readonly type?: string; +} + +// @public (undocumented) +export interface DppTrackedResourceList { + nextLink?: string; +} + +// @public (undocumented) +export interface DppWorkerRequest { + // (undocumented) + cultureInfo?: string; + headers?: { + [propertyName: string]: string[]; + }; + // (undocumented) + httpMethod?: string; + parameters?: { + [propertyName: string]: string; + }; + // (undocumented) + subscriptionId?: string; + // (undocumented) + supportedGroupVersions?: string[]; + // (undocumented) + uri?: string; +} + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorModel { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorModel[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export type ExistingResourcePolicy = string; + +// @public +export interface ExportJobs { + beginTrigger(resourceGroupName: string, vaultName: string, options?: ExportJobsTriggerOptionalParams): Promise, ExportJobsTriggerResponse>>; + beginTriggerAndWait(resourceGroupName: string, vaultName: string, options?: ExportJobsTriggerOptionalParams): Promise; +} + +// @public +export interface ExportJobsOperationResult { + get(resourceGroupName: string, vaultName: string, operationId: string, options?: ExportJobsOperationResultGetOptionalParams): Promise; +} + +// @public +export interface ExportJobsOperationResultGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ExportJobsOperationResultGetResponse = ExportJobsResult; + +// @public +export interface ExportJobsResult { + readonly blobSasKey?: string; + readonly blobUrl?: string; + readonly excelFileBlobSasKey?: string; + readonly excelFileBlobUrl?: string; +} + +// @public +export interface ExportJobsTriggerHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface ExportJobsTriggerOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ExportJobsTriggerResponse = ExportJobsTriggerHeaders; + +// @public +export type FeatureSupportStatus = string; + +// @public +export type FeatureType = string; + +// @public +export interface FeatureValidationRequest extends FeatureValidationRequestBase { + featureName?: string; + featureType?: FeatureType; + objectType: "FeatureValidationRequest"; +} + +// @public +export interface FeatureValidationRequestBase { + objectType: "FeatureValidationRequest"; +} + +// @public (undocumented) +export type FeatureValidationRequestBaseUnion = FeatureValidationRequestBase | FeatureValidationRequest; + +// @public +export interface FeatureValidationResponse extends FeatureValidationResponseBase { + features?: SupportedFeature[]; + featureType?: FeatureType; + objectType: "FeatureValidationResponse"; +} + +// @public +export interface FeatureValidationResponseBase { + objectType: "FeatureValidationResponse"; +} + +// @public (undocumented) +export type FeatureValidationResponseBaseUnion = FeatureValidationResponseBase | FeatureValidationResponse; + +// @public +export function getContinuationToken(page: unknown): string | undefined; + +// @public +export interface ImmediateCopyOption extends CopyOption { + objectType: "ImmediateCopyOption"; +} + +// @public +export interface ImmutabilitySettings { + state?: ImmutabilityState; +} + +// @public +export type ImmutabilityState = string; + +// @public +export interface InnerError { + additionalInfo?: { + [propertyName: string]: string; + }; + code?: string; + embeddedInnerError?: InnerError; +} + +// @public +export interface ItemLevelRestoreCriteria { + objectType: "ItemPathBasedRestoreCriteria" | "RangeBasedItemLevelRestoreCriteria" | "KubernetesStorageClassRestoreCriteria" | "KubernetesPVRestoreCriteria" | "KubernetesClusterRestoreCriteria"; +} + +// @public (undocumented) +export type ItemLevelRestoreCriteriaUnion = ItemLevelRestoreCriteria | ItemPathBasedRestoreCriteria | RangeBasedItemLevelRestoreCriteria | KubernetesStorageClassRestoreCriteria | KubernetesPVRestoreCriteria | KubernetesClusterRestoreCriteria; + +// @public +export interface ItemLevelRestoreTargetInfo extends RestoreTargetInfoBase { + datasourceAuthCredentials?: AuthCredentialsUnion; + datasourceInfo: Datasource; + datasourceSetInfo?: DatasourceSet; + objectType: "ItemLevelRestoreTargetInfo"; + restoreCriteria: ItemLevelRestoreCriteriaUnion[]; +} + +// @public +export interface ItemPathBasedRestoreCriteria extends ItemLevelRestoreCriteria { + isPathRelativeToBackupItem: boolean; + itemPath: string; + objectType: "ItemPathBasedRestoreCriteria"; + subItemPathPrefix?: string[]; +} + +// @public +export interface JobExtendedInfo { + additionalDetails?: { + [propertyName: string]: string; + }; + readonly backupInstanceState?: string; + readonly dataTransferredInBytes?: number; + readonly recoveryDestination?: string; + readonly sourceRecoverPoint?: RestoreJobRecoveryPointDetails; + readonly subTasks?: JobSubTask[]; + readonly targetRecoverPoint?: RestoreJobRecoveryPointDetails; +} + +// @public +export interface Jobs { + get(resourceGroupName: string, vaultName: string, jobId: string, options?: JobsGetOptionalParams): Promise; + list(resourceGroupName: string, vaultName: string, options?: JobsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface JobsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type JobsGetResponse = AzureBackupJobResource; + +// @public +export interface JobsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type JobsListNextResponse = AzureBackupJobResourceList; + +// @public +export interface JobsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type JobsListResponse = AzureBackupJobResourceList; + +// @public +export interface JobSubTask { + additionalDetails?: { + [propertyName: string]: string; + }; + taskId: number; + taskName: string; + readonly taskProgress?: string; + taskStatus: string; +} + +// @public +export enum KnownAbsoluteMarker { + AllBackup = "AllBackup", + FirstOfDay = "FirstOfDay", + FirstOfMonth = "FirstOfMonth", + FirstOfWeek = "FirstOfWeek", + FirstOfYear = "FirstOfYear" +} + +// @public +export enum KnownAlertsState { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownCurrentProtectionState { + BackupSchedulesSuspended = "BackupSchedulesSuspended", + ConfiguringProtection = "ConfiguringProtection", + ConfiguringProtectionFailed = "ConfiguringProtectionFailed", + Invalid = "Invalid", + NotProtected = "NotProtected", + ProtectionConfigured = "ProtectionConfigured", + ProtectionError = "ProtectionError", + ProtectionStopped = "ProtectionStopped", + RetentionSchedulesSuspended = "RetentionSchedulesSuspended", + SoftDeleted = "SoftDeleted", + SoftDeleting = "SoftDeleting", + UpdatingProtection = "UpdatingProtection" +} + +// @public +export enum KnownDataStoreTypes { + ArchiveStore = "ArchiveStore", + OperationalStore = "OperationalStore", + VaultStore = "VaultStore" +} + +// @public +export enum KnownDayOfWeek { + Friday = "Friday", + Monday = "Monday", + Saturday = "Saturday", + Sunday = "Sunday", + Thursday = "Thursday", + Tuesday = "Tuesday", + Wednesday = "Wednesday" +} + +// @public +export enum KnownExistingResourcePolicy { + Patch = "Patch", + Skip = "Skip" +} + +// @public +export enum KnownFeatureSupportStatus { + AlphaPreview = "AlphaPreview", + GenerallyAvailable = "GenerallyAvailable", + Invalid = "Invalid", + NotSupported = "NotSupported", + PrivatePreview = "PrivatePreview", + PublicPreview = "PublicPreview" +} + +// @public +export enum KnownFeatureType { + DataSourceType = "DataSourceType", + Invalid = "Invalid" +} + +// @public +export enum KnownImmutabilityState { + Disabled = "Disabled", + Locked = "Locked", + Unlocked = "Unlocked" +} + +// @public +export enum KnownMonth { + April = "April", + August = "August", + December = "December", + February = "February", + January = "January", + July = "July", + June = "June", + March = "March", + May = "May", + November = "November", + October = "October", + September = "September" +} + +// @public +export enum KnownPersistentVolumeRestoreMode { + RestoreWithoutVolumeData = "RestoreWithoutVolumeData", + RestoreWithVolumeData = "RestoreWithVolumeData" +} + +// @public +export enum KnownProvisioningState { + Failed = "Failed", + Provisioning = "Provisioning", + Succeeded = "Succeeded", + Unknown = "Unknown", + Updating = "Updating" +} + +// @public +export enum KnownRecoveryOption { + FailIfExists = "FailIfExists" +} + +// @public +export enum KnownRehydrationPriority { + High = "High", + Invalid = "Invalid", + Standard = "Standard" +} + +// @public +export enum KnownRehydrationStatus { + Completed = "COMPLETED", + CreateINProgress = "CREATE_IN_PROGRESS", + Deleted = "DELETED", + DeleteINProgress = "DELETE_IN_PROGRESS", + Failed = "FAILED" +} + +// @public +export enum KnownResourceGuardProvisioningState { + Failed = "Failed", + Provisioning = "Provisioning", + Succeeded = "Succeeded", + Unknown = "Unknown", + Updating = "Updating" +} + +// @public +export enum KnownResourceMoveState { + CommitFailed = "CommitFailed", + CommitTimedout = "CommitTimedout", + CriticalFailure = "CriticalFailure", + Failed = "Failed", + InProgress = "InProgress", + MoveSucceeded = "MoveSucceeded", + PartialSuccess = "PartialSuccess", + PrepareFailed = "PrepareFailed", + PrepareTimedout = "PrepareTimedout", + Unknown = "Unknown" +} + +// @public +export enum KnownRestoreSourceDataStoreType { + ArchiveStore = "ArchiveStore", + OperationalStore = "OperationalStore", + VaultStore = "VaultStore" +} + +// @public +export enum KnownRestoreTargetLocationType { + AzureBlobs = "AzureBlobs", + AzureFiles = "AzureFiles", + Invalid = "Invalid" +} + +// @public +export enum KnownSecretStoreType { + AzureKeyVault = "AzureKeyVault", + Invalid = "Invalid" +} + +// @public +export enum KnownSoftDeleteState { + AlwaysOn = "AlwaysOn", + Off = "Off", + On = "On" +} + +// @public +export enum KnownSourceDataStoreType { + ArchiveStore = "ArchiveStore", + SnapshotStore = "SnapshotStore", + VaultStore = "VaultStore" +} + +// @public +export enum KnownStatus { + ConfiguringProtection = "ConfiguringProtection", + ConfiguringProtectionFailed = "ConfiguringProtectionFailed", + ProtectionConfigured = "ProtectionConfigured", + ProtectionStopped = "ProtectionStopped", + SoftDeleted = "SoftDeleted", + SoftDeleting = "SoftDeleting" +} + +// @public +export enum KnownStorageSettingStoreTypes { + ArchiveStore = "ArchiveStore", + SnapshotStore = "SnapshotStore", + VaultStore = "VaultStore" +} + +// @public +export enum KnownStorageSettingTypes { + GeoRedundant = "GeoRedundant", + LocallyRedundant = "LocallyRedundant", + ZoneRedundant = "ZoneRedundant" +} + +// @public +export enum KnownSyncType { + Default = "Default", + ForceResync = "ForceResync" +} + +// @public +export enum KnownValidationType { + DeepValidation = "DeepValidation", + ShallowValidation = "ShallowValidation" +} + +// @public +export enum KnownWeekNumber { + First = "First", + Fourth = "Fourth", + Last = "Last", + Second = "Second", + Third = "Third" +} + +// @public +export interface KubernetesClusterBackupDatasourceParameters extends BackupDatasourceParameters { + excludedNamespaces?: string[]; + excludedResourceTypes?: string[]; + includeClusterScopeResources: boolean; + includedNamespaces?: string[]; + includedResourceTypes?: string[]; + labelSelectors?: string[]; + objectType: "KubernetesClusterBackupDatasourceParameters"; + snapshotVolumes: boolean; +} + +// @public +export interface KubernetesClusterRestoreCriteria extends ItemLevelRestoreCriteria { + conflictPolicy?: ExistingResourcePolicy; + excludedNamespaces?: string[]; + excludedResourceTypes?: string[]; + includeClusterScopeResources: boolean; + includedNamespaces?: string[]; + includedResourceTypes?: string[]; + labelSelectors?: string[]; + namespaceMappings?: { + [propertyName: string]: string; + }; + objectType: "KubernetesClusterRestoreCriteria"; + persistentVolumeRestoreMode?: PersistentVolumeRestoreMode; +} + +// @public +export interface KubernetesPVRestoreCriteria extends ItemLevelRestoreCriteria { + name?: string; + objectType: "KubernetesPVRestoreCriteria"; + storageClassName?: string; +} + +// @public +export interface KubernetesStorageClassRestoreCriteria extends ItemLevelRestoreCriteria { + objectType: "KubernetesStorageClassRestoreCriteria"; + provisioner?: string; + selectedStorageClassName?: string; +} + +// @public +export interface MonitoringSettings { + azureMonitorAlertSettings?: AzureMonitorAlertSettings; +} + +// @public +export type Month = string; + +// @public +export interface OperationExtendedInfo { + objectType: "OperationJobExtendedInfo"; +} + +// @public (undocumented) +export type OperationExtendedInfoUnion = OperationExtendedInfo | OperationJobExtendedInfo; + +// @public +export interface OperationJobExtendedInfo extends OperationExtendedInfo { + jobId?: string; + objectType: "OperationJobExtendedInfo"; +} + +// @public +export interface OperationResource { + endTime?: Date; + error?: ErrorModel; + id?: string; + name?: string; + properties?: OperationExtendedInfoUnion; + startTime?: Date; + // (undocumented) + status?: string; +} + +// @public +export interface OperationResult { + get(operationId: string, location: string, options?: OperationResultGetOptionalParams): Promise; +} + +// @public +export interface OperationResultGetHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface OperationResultGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationResultGetResponse = OperationJobExtendedInfo; + +// @public +export interface OperationStatus { + get(location: string, operationId: string, options?: OperationStatusGetOptionalParams): Promise; +} + +// @public +export interface OperationStatusBackupVaultContext { + get(resourceGroupName: string, vaultName: string, operationId: string, options?: OperationStatusBackupVaultContextGetOptionalParams): Promise; +} + +// @public +export interface OperationStatusBackupVaultContextGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationStatusBackupVaultContextGetResponse = OperationResource; + +// @public +export interface OperationStatusGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationStatusGetResponse = OperationResource; + +// @public +export interface OperationStatusResourceGroupContext { + get(resourceGroupName: string, operationId: string, options?: OperationStatusResourceGroupContextGetOptionalParams): Promise; +} + +// @public +export interface OperationStatusResourceGroupContextGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationStatusResourceGroupContextGetResponse = OperationResource; + +// @public +export interface PatchBackupVaultInput { + monitoringSettings?: MonitoringSettings; + securitySettings?: SecuritySettings; +} + +// @public +export interface PatchResourceRequestInput { + identity?: DppIdentityDetails; + properties?: PatchBackupVaultInput; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export type PersistentVolumeRestoreMode = string; + +// @public +export interface PolicyInfo { + // (undocumented) + policyId: string; + policyParameters?: PolicyParameters; + readonly policyVersion?: string; +} + +// @public +export interface PolicyParameters { + backupDatasourceParametersList?: BackupDatasourceParametersUnion[]; + dataStoreParametersList?: DataStoreParametersUnion[]; +} + +// @public +export interface ProtectionStatusDetails { + errorDetails?: UserFacingError; + status?: Status; +} + +// @public +export type ProvisioningState = string; + +// @public +export interface RangeBasedItemLevelRestoreCriteria extends ItemLevelRestoreCriteria { + maxMatchingValue?: string; + minMatchingValue?: string; + objectType: "RangeBasedItemLevelRestoreCriteria"; +} + +// @public +export type RecoveryOption = string; + +// @public +export interface RecoveryPointDataStoreDetails { + // (undocumented) + creationTime?: Date; + // (undocumented) + expiryTime?: Date; + // (undocumented) + id?: string; + // (undocumented) + metaData?: string; + readonly rehydrationExpiryTime?: Date; + readonly rehydrationStatus?: RehydrationStatus; + // (undocumented) + state?: string; + // (undocumented) + type?: string; + // (undocumented) + visible?: boolean; +} + +// @public +export interface RecoveryPoints { + get(resourceGroupName: string, vaultName: string, backupInstanceName: string, recoveryPointId: string, options?: RecoveryPointsGetOptionalParams): Promise; + list(resourceGroupName: string, vaultName: string, backupInstanceName: string, options?: RecoveryPointsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public (undocumented) +export interface RecoveryPointsFilters { + // (undocumented) + endDate?: string; + // (undocumented) + extendedInfo?: boolean; + // (undocumented) + isVisible?: boolean; + // (undocumented) + restorePointDataStoreId?: string; + // (undocumented) + restorePointState?: string; + // (undocumented) + startDate?: string; +} + +// @public +export interface RecoveryPointsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type RecoveryPointsGetResponse = AzureBackupRecoveryPointResource; + +// @public +export interface RecoveryPointsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type RecoveryPointsListNextResponse = AzureBackupRecoveryPointResourceList; + +// @public +export interface RecoveryPointsListOptionalParams extends coreClient.OperationOptions { + filter?: string; + skipToken?: string; +} + +// @public +export type RecoveryPointsListResponse = AzureBackupRecoveryPointResourceList; + +// @public +export type RehydrationPriority = string; + +// @public +export type RehydrationStatus = string; + +// @public (undocumented) +export interface ResourceGuard { + readonly allowAutoApprovals?: boolean; + readonly description?: string; + readonly provisioningState?: ResourceGuardProvisioningState; + readonly resourceGuardOperations?: ResourceGuardOperation[]; + vaultCriticalOperationExclusionList?: string[]; +} + +// @public +export interface ResourceGuardOperation { + readonly requestResourceType?: string; + readonly vaultCriticalOperation?: string; +} + +// @public (undocumented) +export interface ResourceGuardOperationDetail { + // (undocumented) + defaultResourceRequest?: string; + // (undocumented) + vaultCriticalOperation?: string; +} + +// @public +export type ResourceGuardProvisioningState = string; + +// @public (undocumented) +export interface ResourceGuardProxyBase { + // (undocumented) + description?: string; + // (undocumented) + lastUpdatedTime?: string; + // (undocumented) + resourceGuardOperationDetails?: ResourceGuardOperationDetail[]; + // (undocumented) + resourceGuardResourceId?: string; +} + +// @public (undocumented) +export interface ResourceGuardProxyBaseResource extends DppResource { + properties?: ResourceGuardProxyBase; +} + +// @public +export interface ResourceGuardProxyBaseResourceList extends DppResourceList { + value?: ResourceGuardProxyBaseResource[]; +} + +// @public (undocumented) +export interface ResourceGuardResource extends DppTrackedResource { + properties?: ResourceGuard; +} + +// @public +export interface ResourceGuardResourceList extends DppTrackedResourceList { + value?: ResourceGuardResource[]; +} + +// @public +export interface ResourceGuards { + delete(resourceGroupName: string, resourceGuardsName: string, options?: ResourceGuardsDeleteOptionalParams): Promise; + get(resourceGroupName: string, resourceGuardsName: string, options?: ResourceGuardsGetOptionalParams): Promise; + getDefaultBackupSecurityPINRequestsObject(resourceGroupName: string, resourceGuardsName: string, requestName: string, options?: ResourceGuardsGetDefaultBackupSecurityPINRequestsObjectOptionalParams): Promise; + getDefaultDeleteProtectedItemRequestsObject(resourceGroupName: string, resourceGuardsName: string, requestName: string, options?: ResourceGuardsGetDefaultDeleteProtectedItemRequestsObjectOptionalParams): Promise; + getDefaultDeleteResourceGuardProxyRequestsObject(resourceGroupName: string, resourceGuardsName: string, requestName: string, options?: ResourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectOptionalParams): Promise; + getDefaultDisableSoftDeleteRequestsObject(resourceGroupName: string, resourceGuardsName: string, requestName: string, options?: ResourceGuardsGetDefaultDisableSoftDeleteRequestsObjectOptionalParams): Promise; + getDefaultUpdateProtectedItemRequestsObject(resourceGroupName: string, resourceGuardsName: string, requestName: string, options?: ResourceGuardsGetDefaultUpdateProtectedItemRequestsObjectOptionalParams): Promise; + getDefaultUpdateProtectionPolicyRequestsObject(resourceGroupName: string, resourceGuardsName: string, requestName: string, options?: ResourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectOptionalParams): Promise; + listBackupSecurityPINRequestsObjects(resourceGroupName: string, resourceGuardsName: string, options?: ResourceGuardsGetBackupSecurityPINRequestsObjectsOptionalParams): PagedAsyncIterableIterator; + listDeleteProtectedItemRequestsObjects(resourceGroupName: string, resourceGuardsName: string, options?: ResourceGuardsGetDeleteProtectedItemRequestsObjectsOptionalParams): PagedAsyncIterableIterator; + listDeleteResourceGuardProxyRequestsObjects(resourceGroupName: string, resourceGuardsName: string, options?: ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsOptionalParams): PagedAsyncIterableIterator; + listDisableSoftDeleteRequestsObjects(resourceGroupName: string, resourceGuardsName: string, options?: ResourceGuardsGetDisableSoftDeleteRequestsObjectsOptionalParams): PagedAsyncIterableIterator; + listResourcesInResourceGroup(resourceGroupName: string, options?: ResourceGuardsGetResourcesInResourceGroupOptionalParams): PagedAsyncIterableIterator; + listResourcesInSubscription(options?: ResourceGuardsGetResourcesInSubscriptionOptionalParams): PagedAsyncIterableIterator; + listUpdateProtectedItemRequestsObjects(resourceGroupName: string, resourceGuardsName: string, options?: ResourceGuardsGetUpdateProtectedItemRequestsObjectsOptionalParams): PagedAsyncIterableIterator; + listUpdateProtectionPolicyRequestsObjects(resourceGroupName: string, resourceGuardsName: string, options?: ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsOptionalParams): PagedAsyncIterableIterator; + patch(resourceGroupName: string, resourceGuardsName: string, parameters: PatchResourceRequestInput, options?: ResourceGuardsPatchOptionalParams): Promise; + put(resourceGroupName: string, resourceGuardsName: string, parameters: ResourceGuardResource, options?: ResourceGuardsPutOptionalParams): Promise; +} + +// @public +export interface ResourceGuardsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ResourceGuardsGetBackupSecurityPINRequestsObjectsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetBackupSecurityPINRequestsObjectsNextResponse = DppBaseResourceList; + +// @public +export interface ResourceGuardsGetBackupSecurityPINRequestsObjectsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetBackupSecurityPINRequestsObjectsResponse = DppBaseResourceList; + +// @public +export interface ResourceGuardsGetDefaultBackupSecurityPINRequestsObjectOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetDefaultBackupSecurityPINRequestsObjectResponse = DppBaseResource; + +// @public +export interface ResourceGuardsGetDefaultDeleteProtectedItemRequestsObjectOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetDefaultDeleteProtectedItemRequestsObjectResponse = DppBaseResource; + +// @public +export interface ResourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectResponse = DppBaseResource; + +// @public +export interface ResourceGuardsGetDefaultDisableSoftDeleteRequestsObjectOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetDefaultDisableSoftDeleteRequestsObjectResponse = DppBaseResource; + +// @public +export interface ResourceGuardsGetDefaultUpdateProtectedItemRequestsObjectOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetDefaultUpdateProtectedItemRequestsObjectResponse = DppBaseResource; + +// @public +export interface ResourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectResponse = DppBaseResource; + +// @public +export interface ResourceGuardsGetDeleteProtectedItemRequestsObjectsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetDeleteProtectedItemRequestsObjectsNextResponse = DppBaseResourceList; + +// @public +export interface ResourceGuardsGetDeleteProtectedItemRequestsObjectsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetDeleteProtectedItemRequestsObjectsResponse = DppBaseResourceList; + +// @public +export interface ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsNextResponse = DppBaseResourceList; + +// @public +export interface ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsResponse = DppBaseResourceList; + +// @public +export interface ResourceGuardsGetDisableSoftDeleteRequestsObjectsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetDisableSoftDeleteRequestsObjectsNextResponse = DppBaseResourceList; + +// @public +export interface ResourceGuardsGetDisableSoftDeleteRequestsObjectsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetDisableSoftDeleteRequestsObjectsResponse = DppBaseResourceList; + +// @public +export interface ResourceGuardsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ResourceGuardsGetResourcesInResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetResourcesInResourceGroupNextResponse = ResourceGuardResourceList; + +// @public +export interface ResourceGuardsGetResourcesInResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetResourcesInResourceGroupResponse = ResourceGuardResourceList; + +// @public +export interface ResourceGuardsGetResourcesInSubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetResourcesInSubscriptionNextResponse = ResourceGuardResourceList; + +// @public +export interface ResourceGuardsGetResourcesInSubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetResourcesInSubscriptionResponse = ResourceGuardResourceList; + +// @public +export type ResourceGuardsGetResponse = ResourceGuardResource; + +// @public +export interface ResourceGuardsGetUpdateProtectedItemRequestsObjectsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetUpdateProtectedItemRequestsObjectsNextResponse = DppBaseResourceList; + +// @public +export interface ResourceGuardsGetUpdateProtectedItemRequestsObjectsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetUpdateProtectedItemRequestsObjectsResponse = DppBaseResourceList; + +// @public +export interface ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsNextResponse = DppBaseResourceList; + +// @public +export interface ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsResponse = DppBaseResourceList; + +// @public +export interface ResourceGuardsPatchOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsPatchResponse = ResourceGuardResource; + +// @public +export interface ResourceGuardsPutOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourceGuardsPutResponse = ResourceGuardResource; + +// @public +export interface ResourceMoveDetails { + completionTimeUtc?: string; + operationId?: string; + sourceResourcePath?: string; + startTimeUtc?: string; + targetResourcePath?: string; +} + +// @public +export type ResourceMoveState = string; + +// @public (undocumented) +export interface RestorableTimeRange { + endTime: string; + // (undocumented) + objectType?: string; + startTime: string; +} + +// @public +export interface RestorableTimeRanges { + // (undocumented) + find(resourceGroupName: string, vaultName: string, backupInstanceName: string, parameters: AzureBackupFindRestorableTimeRangesRequest, options?: RestorableTimeRangesFindOptionalParams): Promise; +} + +// @public +export interface RestorableTimeRangesFindOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type RestorableTimeRangesFindResponse = AzureBackupFindRestorableTimeRangesResponseResource; + +// @public +export interface RestoreFilesTargetInfo extends RestoreTargetInfoBase { + objectType: "RestoreFilesTargetInfo"; + targetDetails: TargetDetails; +} + +// @public (undocumented) +export interface RestoreJobRecoveryPointDetails { + // (undocumented) + recoveryPointID?: string; + // (undocumented) + recoveryPointTime?: Date; +} + +// @public +export type RestoreSourceDataStoreType = string; + +// @public +export interface RestoreTargetInfo extends RestoreTargetInfoBase { + datasourceAuthCredentials?: AuthCredentialsUnion; + datasourceInfo: Datasource; + datasourceSetInfo?: DatasourceSet; + objectType: "RestoreTargetInfo"; +} + +// @public +export interface RestoreTargetInfoBase { + objectType: "ItemLevelRestoreTargetInfo" | "RestoreFilesTargetInfo" | "RestoreTargetInfo"; + recoveryOption: RecoveryOption; + restoreLocation?: string; +} + +// @public (undocumented) +export type RestoreTargetInfoBaseUnion = RestoreTargetInfoBase | ItemLevelRestoreTargetInfo | RestoreFilesTargetInfo | RestoreTargetInfo; + +// @public +export type RestoreTargetLocationType = string; + +// @public +export interface RetentionTag { + readonly eTag?: string; + readonly id?: string; + tagName: string; +} + +// @public +export interface ScheduleBasedBackupCriteria extends BackupCriteria { + absoluteCriteria?: AbsoluteMarker[]; + daysOfMonth?: Day[]; + daysOfTheWeek?: DayOfWeek[]; + monthsOfYear?: Month[]; + objectType: "ScheduleBasedBackupCriteria"; + scheduleTimes?: Date[]; + weeksOfTheMonth?: WeekNumber[]; +} + +// @public +export interface ScheduleBasedTriggerContext extends TriggerContext { + objectType: "ScheduleBasedTriggerContext"; + schedule: BackupSchedule; + taggingCriteria: TaggingCriteria[]; +} + +// @public +export interface SecretStoreBasedAuthCredentials extends AuthCredentials { + objectType: "SecretStoreBasedAuthCredentials"; + secretStoreResource?: SecretStoreResource; +} + +// @public +export interface SecretStoreResource { + secretStoreType: SecretStoreType; + uri?: string; + value?: string; +} + +// @public +export type SecretStoreType = string; + +// @public +export interface SecuritySettings { + immutabilitySettings?: ImmutabilitySettings; + softDeleteSettings?: SoftDeleteSettings; +} + +// @public +export interface SoftDeleteSettings { + retentionDurationInDays?: number; + state?: SoftDeleteState; +} + +// @public +export type SoftDeleteState = string; + +// @public +export type SourceDataStoreType = string; + +// @public +export interface SourceLifeCycle { + deleteAfter: DeleteOptionUnion; + sourceDataStore: DataStoreInfoBase; + // (undocumented) + targetDataStoreCopySettings?: TargetCopySetting[]; +} + +// @public +export type Status = string; + +// @public +export interface StorageSetting { + datastoreType?: StorageSettingStoreTypes; + type?: StorageSettingTypes; +} + +// @public +export type StorageSettingStoreTypes = string; + +// @public +export type StorageSettingTypes = string; + +// @public +export interface SupportedFeature { + exposureControlledFeatures?: string[]; + featureName?: string; + supportStatus?: FeatureSupportStatus; +} + +// @public +export interface SyncBackupInstanceRequest { + syncType?: SyncType; +} + +// @public +export type SyncType = string; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TaggingCriteria { + criteria?: BackupCriteriaUnion[]; + isDefault: boolean; + taggingPriority: number; + tagInfo: RetentionTag; +} + +// @public +export interface TargetCopySetting { + copyAfter: CopyOptionUnion; + dataStore: DataStoreInfoBase; +} + +// @public +export interface TargetDetails { + filePrefix: string; + restoreTargetLocationType: RestoreTargetLocationType; + url: string; +} + +// @public +export interface TriggerBackupRequest { + backupRuleOptions: AdHocBackupRuleOptions; +} + +// @public +export interface TriggerContext { + objectType: "AdhocBasedTriggerContext" | "ScheduleBasedTriggerContext"; +} + +// @public (undocumented) +export type TriggerContextUnion = TriggerContext | AdhocBasedTriggerContext | ScheduleBasedTriggerContext; + +// @public +export interface UnlockDeleteRequest { + // (undocumented) + resourceGuardOperationRequests?: string[]; + // (undocumented) + resourceToBeDeleted?: string; +} + +// @public +export interface UnlockDeleteResponse { + unlockDeleteExpiryTime?: string; +} + +// @public +export interface UserFacingError { + code?: string; + details?: UserFacingError[]; + innerError?: InnerError; + isRetryable?: boolean; + isUserError?: boolean; + // (undocumented) + message?: string; + properties?: { + [propertyName: string]: string; + }; + recommendedAction?: string[]; + target?: string; +} + +// @public +export interface ValidateForBackupRequest { + backupInstance: BackupInstance; +} + +// @public +export interface ValidateRestoreRequestObject { + restoreRequestObject: AzureBackupRestoreRequestUnion; +} + +// @public +export type ValidationType = string; + +// @public +export type WeekNumber = string; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/dataprotection/arm-dataprotection/rollup.config.js b/sdk/dataprotection/arm-dataprotection/rollup.config.js new file mode 100644 index 000000000000..3f89d7309da5 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/rollup.config.js @@ -0,0 +1,122 @@ +/* + * 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 nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs(), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/dataprotection/arm-dataprotection/sample.env b/sdk/dataprotection/arm-dataprotection/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesAdhocBackupSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesAdhocBackupSample.ts new file mode 100644 index 000000000000..532aaf55babd --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesAdhocBackupSample.ts @@ -0,0 +1,55 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + TriggerBackupRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Trigger adhoc backup + * + * @summary Trigger adhoc backup + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerBackup.json + */ +async function triggerAdhocBackup() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters: TriggerBackupRequest = { + backupRuleOptions: { + ruleName: "BackupWeekly", + triggerOption: { retentionTagOverride: "yearly" } + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginAdhocBackupAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + triggerAdhocBackup(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesCreateOrUpdateSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..50da49858bc6 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesCreateOrUpdateSample.ts @@ -0,0 +1,98 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + BackupInstanceResource, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update a backup instance in a backup vault + * + * @summary Create or update a backup instance in a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/PutBackupInstance.json + */ +async function createBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters: BackupInstanceResource = { + properties: { + dataSourceInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "Datasource", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + resourceLocation: "", + resourceName: "testdb", + resourceType: "Microsoft.DBforPostgreSQL/servers/databases", + resourceUri: "" + }, + dataSourceSetInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "DatasourceSet", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + resourceLocation: "", + resourceName: "viveksipgtest", + resourceType: "Microsoft.DBforPostgreSQL/servers", + resourceUri: "" + }, + datasourceAuthCredentials: { + objectType: "SecretStoreBasedAuthCredentials", + secretStoreResource: { + secretStoreType: "AzureKeyVault", + uri: "https://samplevault.vault.azure.net/secrets/credentials" + } + }, + friendlyName: "harshitbi2", + objectType: "BackupInstance", + policyInfo: { + policyId: + "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/Backupvaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1", + policyParameters: { + dataStoreParametersList: [ + { + dataStoreType: "OperationalStore", + objectType: "AzureOperationalStoreParameters", + resourceGroupId: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest" + } + ] + } + }, + validationType: "ShallowValidation" + }, + tags: { key1: "val1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginCreateOrUpdateAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + createBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesDeleteSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesDeleteSample.ts new file mode 100644 index 000000000000..f8e337251de3 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a backup instance in a backup vault + * + * @summary Delete a backup instance in a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/DeleteBackupInstance.json + */ +async function deleteBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginDeleteAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + deleteBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesExtensionRoutingListSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesExtensionRoutingListSample.ts new file mode 100644 index 000000000000..0e29cf09d89e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesExtensionRoutingListSample.ts @@ -0,0 +1,44 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a list backup instances associated with a tracked resource + * + * @summary Gets a list backup instances associated with a tracked resource + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListBackupInstancesExtensionRouting.json + */ +async function listBackupInstancesAssociatedWithAnAzureResource() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceId = + "subscriptions/36d32b25-3dc7-41b0-bde1-397500644591/resourceGroups/testRG/providers/Microsoft.Compute/disks/testDisk"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.backupInstancesExtensionRouting.list( + resourceId + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listBackupInstancesAssociatedWithAnAzureResource(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesGetBackupInstanceOperationResultSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesGetBackupInstanceOperationResultSample.ts new file mode 100644 index 000000000000..3a2aa5d55342 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesGetBackupInstanceOperationResultSample.ts @@ -0,0 +1,48 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get result of backup instance creation operation + * + * @summary Get result of backup instance creation operation + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetBackupInstanceOperationResult.json + */ +async function getBackupInstanceOperationResult() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const backupInstanceName = "testInstance1"; + const operationId = + "YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA=="; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.getBackupInstanceOperationResult( + resourceGroupName, + vaultName, + backupInstanceName, + operationId + ); + console.log(result); +} + +async function main() { + getBackupInstanceOperationResult(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesGetSample.ts new file mode 100644 index 000000000000..1cd542765f99 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesGetSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a backup instance with name in a backup vault + * + * @summary Gets a backup instance with name in a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetBackupInstance.json + */ +async function getBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.get( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + getBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesListSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesListSample.ts new file mode 100644 index 000000000000..7eabf09dadb3 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesListSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a backup instances belonging to a backup vault + * + * @summary Gets a backup instances belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListBackupInstances.json + */ +async function listBackupInstancesInAVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.backupInstances.list( + resourceGroupName, + vaultName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listBackupInstancesInAVault(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesResumeBackupsSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesResumeBackupsSample.ts new file mode 100644 index 000000000000..2bd881a71f9e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesResumeBackupsSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to This operation will resume backups for backup instance + * + * @summary This operation will resume backups for backup instance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ResumeBackups.json + */ +async function resumeBackups() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginResumeBackupsAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + resumeBackups(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesResumeProtectionSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesResumeProtectionSample.ts new file mode 100644 index 000000000000..188fcfe4221c --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesResumeProtectionSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to This operation will resume protection for a stopped backup instance + * + * @summary This operation will resume protection for a stopped backup instance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ResumeProtection.json + */ +async function resumeProtection() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginResumeProtectionAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + resumeProtection(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesStopProtectionSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesStopProtectionSample.ts new file mode 100644 index 000000000000..e03836194e42 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesStopProtectionSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to This operation will stop protection of a backup instance and data will be held forever + * + * @summary This operation will stop protection of a backup instance and data will be held forever + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/StopProtection.json + */ +async function stopProtection() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginStopProtectionAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + stopProtection(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesSuspendBackupsSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesSuspendBackupsSample.ts new file mode 100644 index 000000000000..5c5468780fad --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesSuspendBackupsSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to This operation will stop backup for a backup instance and retains the backup data as per the policy (except latest Recovery point, which will be retained forever) + * + * @summary This operation will stop backup for a backup instance and retains the backup data as per the policy (except latest Recovery point, which will be retained forever) + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/SuspendBackups.json + */ +async function suspendBackups() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginSuspendBackupsAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + suspendBackups(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesSyncBackupInstanceSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesSyncBackupInstanceSample.ts new file mode 100644 index 000000000000..281cacdd3950 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesSyncBackupInstanceSample.ts @@ -0,0 +1,52 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + SyncBackupInstanceRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Sync backup instance again in case of failure +This action will retry last failed operation and will bring backup instance to valid state + * + * @summary Sync backup instance again in case of failure +This action will retry last failed operation and will bring backup instance to valid state + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/SyncBackupInstance.json + */ +async function syncBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const parameters: SyncBackupInstanceRequest = { syncType: "Default" }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginSyncBackupInstanceAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + syncBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesTriggerRehydrateSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesTriggerRehydrateSample.ts new file mode 100644 index 000000000000..4c69ceeff3bb --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesTriggerRehydrateSample.ts @@ -0,0 +1,54 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + AzureBackupRehydrationRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to rehydrate recovery point for restore for a BackupInstance + * + * @summary rehydrate recovery point for restore for a BackupInstance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRehydrate.json + */ +async function triggerRehydrate() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters: AzureBackupRehydrationRequest = { + recoveryPointId: "hardcodedRP", + rehydrationPriority: "High", + rehydrationRetentionDuration: "7D" + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginTriggerRehydrateAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + triggerRehydrate(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesTriggerRestoreSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesTriggerRestoreSample.ts new file mode 100644 index 000000000000..a22bb9521d4e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesTriggerRestoreSample.ts @@ -0,0 +1,192 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + AzureBackupRecoveryPointBasedRestoreRequestUnion, + AzureBackupRestoreWithRehydrationRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Triggers restore for a BackupInstance + * + * @summary Triggers restore for a BackupInstance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRestore.json + */ +async function triggerRestore() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters: AzureBackupRecoveryPointBasedRestoreRequestUnion = { + objectType: "AzureBackupRecoveryPointBasedRestoreRequest", + recoveryPointId: "hardcodedRP", + restoreTargetInfo: { + datasourceAuthCredentials: { + objectType: "SecretStoreBasedAuthCredentials", + secretStoreResource: { + secretStoreType: "AzureKeyVault", + uri: "https://samplevault.vault.azure.net/secrets/credentials" + } + }, + datasourceInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "Datasource", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/targetdb", + resourceLocation: "", + resourceName: "targetdb", + resourceType: "Microsoft.DBforPostgreSQL/servers/databases", + resourceUri: "" + }, + datasourceSetInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "DatasourceSet", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + resourceLocation: "", + resourceName: "viveksipgtest", + resourceType: "Microsoft.DBforPostgreSQL/servers", + resourceUri: "" + }, + objectType: "RestoreTargetInfo", + recoveryOption: "FailIfExists", + restoreLocation: "southeastasia" + }, + sourceDataStoreType: "VaultStore", + sourceResourceId: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb" + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginTriggerRestoreAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Triggers restore for a BackupInstance + * + * @summary Triggers restore for a BackupInstance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRestoreAsFiles.json + */ +async function triggerRestoreAsFiles() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters: AzureBackupRecoveryPointBasedRestoreRequestUnion = { + objectType: "AzureBackupRecoveryPointBasedRestoreRequest", + recoveryPointId: "hardcodedRP", + restoreTargetInfo: { + objectType: "RestoreFilesTargetInfo", + recoveryOption: "FailIfExists", + restoreLocation: "southeastasia", + targetDetails: { + filePrefix: "restoredblob", + restoreTargetLocationType: "AzureBlobs", + url: "https://teststorage.blob.core.windows.net/restoretest" + } + }, + sourceDataStoreType: "VaultStore", + sourceResourceId: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb" + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginTriggerRestoreAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Triggers restore for a BackupInstance + * + * @summary Triggers restore for a BackupInstance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRestoreWithRehydration.json + */ +async function triggerRestoreWithRehydration() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters: AzureBackupRestoreWithRehydrationRequest = { + objectType: "AzureBackupRestoreWithRehydrationRequest", + recoveryPointId: "hardcodedRP", + rehydrationPriority: "High", + rehydrationRetentionDuration: "7D", + restoreTargetInfo: { + datasourceInfo: { + datasourceType: "OssDB", + objectType: "Datasource", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + resourceLocation: "", + resourceName: "testdb", + resourceType: "Microsoft.DBforPostgreSQL/servers/databases", + resourceUri: "" + }, + datasourceSetInfo: { + datasourceType: "OssDB", + objectType: "DatasourceSet", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + resourceLocation: "", + resourceName: "viveksipgtest", + resourceType: "Microsoft.DBforPostgreSQL/servers", + resourceUri: "" + }, + objectType: "RestoreTargetInfo", + recoveryOption: "FailIfExists", + restoreLocation: "southeastasia" + }, + sourceDataStoreType: "VaultStore", + sourceResourceId: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb" + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginTriggerRestoreAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + triggerRestore(); + triggerRestoreAsFiles(); + triggerRestoreWithRehydration(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesValidateForBackupSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesValidateForBackupSample.ts new file mode 100644 index 000000000000..fbc342d18395 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesValidateForBackupSample.ts @@ -0,0 +1,84 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ValidateForBackupRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Validate whether adhoc backup will be successful or not + * + * @summary Validate whether adhoc backup will be successful or not + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ValidateForBackup.json + */ +async function validateForBackup() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const parameters: ValidateForBackupRequest = { + backupInstance: { + dataSourceInfo: { + datasourceType: "OssDB", + objectType: "Datasource", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + resourceLocation: "", + resourceName: "testdb", + resourceType: "Microsoft.DBforPostgreSQL/servers/databases", + resourceUri: "" + }, + dataSourceSetInfo: { + datasourceType: "OssDB", + objectType: "DatasourceSet", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + resourceLocation: "", + resourceName: "viveksipgtest", + resourceType: "Microsoft.DBforPostgreSQL/servers", + resourceUri: "" + }, + datasourceAuthCredentials: { + objectType: "SecretStoreBasedAuthCredentials", + secretStoreResource: { + secretStoreType: "AzureKeyVault", + uri: "https://samplevault.vault.azure.net/secrets/credentials" + } + }, + friendlyName: "harshitbi2", + objectType: "BackupInstance", + policyInfo: { + policyId: + "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/Backupvaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginValidateForBackupAndWait( + resourceGroupName, + vaultName, + parameters + ); + console.log(result); +} + +async function main() { + validateForBackup(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesValidateForRestoreSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesValidateForRestoreSample.ts new file mode 100644 index 000000000000..62c2959e5c3f --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupInstancesValidateForRestoreSample.ts @@ -0,0 +1,90 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ValidateRestoreRequestObject, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Validates if Restore can be triggered for a DataSource + * + * @summary Validates if Restore can be triggered for a DataSource + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ValidateRestore.json + */ +async function validateRestore() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters: ValidateRestoreRequestObject = { + restoreRequestObject: { + objectType: "AzureBackupRecoveryPointBasedRestoreRequest", + recoveryPointId: "hardcodedRP", + restoreTargetInfo: { + datasourceAuthCredentials: { + objectType: "SecretStoreBasedAuthCredentials", + secretStoreResource: { + secretStoreType: "AzureKeyVault", + uri: "https://samplevault.vault.azure.net/secrets/credentials" + } + }, + datasourceInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "Datasource", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/targetdb", + resourceLocation: "", + resourceName: "targetdb", + resourceType: "Microsoft.DBforPostgreSQL/servers/databases", + resourceUri: "" + }, + datasourceSetInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "DatasourceSet", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + resourceLocation: "", + resourceName: "viveksipgtest", + resourceType: "Microsoft.DBforPostgreSQL/servers", + resourceUri: "" + }, + objectType: "RestoreTargetInfo", + recoveryOption: "FailIfExists", + restoreLocation: "southeastasia" + }, + sourceDataStoreType: "VaultStore", + sourceResourceId: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginValidateForRestoreAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + validateRestore(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupPoliciesCreateOrUpdateSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupPoliciesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..fa10b5855792 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupPoliciesCreateOrUpdateSample.ts @@ -0,0 +1,128 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + BaseBackupPolicyResource, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or Updates a backup policy belonging to a backup vault + * + * @summary Creates or Updates a backup policy belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json + */ +async function createOrUpdateBackupPolicy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PrivatePreviewVault"; + const backupPolicyName = "OSSDBPolicy"; + const parameters: BaseBackupPolicyResource = { + properties: { + datasourceTypes: ["OssDB"], + objectType: "BackupPolicy", + policyRules: [ + { + name: "BackupWeekly", + backupParameters: { + backupType: "Full", + objectType: "AzureBackupParams" + }, + dataStore: { + dataStoreType: "VaultStore", + objectType: "DataStoreInfoBase" + }, + objectType: "AzureBackupRule", + trigger: { + objectType: "ScheduleBasedTriggerContext", + schedule: { + repeatingTimeIntervals: ["R/2019-11-20T08:00:00-08:00/P1W"] + }, + taggingCriteria: [ + { + isDefault: true, + tagInfo: { tagName: "Default" }, + taggingPriority: 99 + }, + { + criteria: [ + { + daysOfTheWeek: ["Sunday"], + objectType: "ScheduleBasedBackupCriteria", + scheduleTimes: [new Date("2019-03-01T13:00:00Z")] + } + ], + isDefault: false, + tagInfo: { tagName: "Weekly" }, + taggingPriority: 20 + } + ] + } + }, + { + name: "Default", + isDefault: true, + lifecycles: [ + { + deleteAfter: { + duration: "P1W", + objectType: "AbsoluteDeleteOption" + }, + sourceDataStore: { + dataStoreType: "VaultStore", + objectType: "DataStoreInfoBase" + } + } + ], + objectType: "AzureRetentionRule" + }, + { + name: "Weekly", + isDefault: false, + lifecycles: [ + { + deleteAfter: { + duration: "P12W", + objectType: "AbsoluteDeleteOption" + }, + sourceDataStore: { + dataStoreType: "VaultStore", + objectType: "DataStoreInfoBase" + } + } + ], + objectType: "AzureRetentionRule" + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupPolicies.createOrUpdate( + resourceGroupName, + vaultName, + backupPolicyName, + parameters + ); + console.log(result); +} + +async function main() { + createOrUpdateBackupPolicy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupPoliciesDeleteSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupPoliciesDeleteSample.ts new file mode 100644 index 000000000000..be672bff0a10 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupPoliciesDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a backup policy belonging to a backup vault + * + * @summary Deletes a backup policy belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/DeleteBackupPolicy.json + */ +async function deleteBackupPolicy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PrivatePreviewVault"; + const backupPolicyName = "OSSDBPolicy"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupPolicies.delete( + resourceGroupName, + vaultName, + backupPolicyName + ); + console.log(result); +} + +async function main() { + deleteBackupPolicy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupPoliciesGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupPoliciesGetSample.ts new file mode 100644 index 000000000000..475e0952e7f1 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupPoliciesGetSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a backup policy belonging to a backup vault + * + * @summary Gets a backup policy belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/GetBackupPolicy.json + */ +async function getBackupPolicy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PrivatePreviewVault"; + const backupPolicyName = "OSSDBPolicy"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupPolicies.get( + resourceGroupName, + vaultName, + backupPolicyName + ); + console.log(result); +} + +async function main() { + getBackupPolicy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupPoliciesListSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupPoliciesListSample.ts new file mode 100644 index 000000000000..c955ab890f7e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupPoliciesListSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns list of backup policies belonging to a backup vault + * + * @summary Returns list of backup policies belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/ListBackupPolicy.json + */ +async function listBackupPolicy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PrivatePreviewVault"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.backupPolicies.list( + resourceGroupName, + vaultName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listBackupPolicy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultOperationResultsGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultOperationResultsGetSample.ts new file mode 100644 index 000000000000..89dbda510234 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultOperationResultsGetSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetOperationResultPatch.json + */ +async function getOperationResultPatch() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const operationId = + "YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA=="; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaultOperationResults.get( + resourceGroupName, + vaultName, + operationId + ); + console.log(result); +} + +async function main() { + getOperationResultPatch(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsCheckNameAvailabilitySample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..0eb31a447bf0 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsCheckNameAvailabilitySample.ts @@ -0,0 +1,51 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + CheckNameAvailabilityRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to API to check for resource name availability + * + * @summary API to check for resource name availability + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/CheckBackupVaultsNameAvailability.json + */ +async function checkBackupVaultsNameAvailability() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const location = "westus"; + const parameters: CheckNameAvailabilityRequest = { + name: "swaggerExample", + type: "Microsoft.DataProtection/BackupVaults" + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.checkNameAvailability( + resourceGroupName, + location, + parameters + ); + console.log(result); +} + +async function main() { + checkBackupVaultsNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsCreateOrUpdateSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..807bb70755db --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsCreateOrUpdateSample.ts @@ -0,0 +1,97 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + BackupVaultResource, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a BackupVault resource belonging to a resource group. + * + * @summary Creates or updates a BackupVault resource belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/PutBackupVault.json + */ +async function createBackupVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const parameters: BackupVaultResource = { + identity: { type: "None" }, + location: "WestUS", + properties: { + monitoringSettings: { + azureMonitorAlertSettings: { alertsForAllJobFailures: "Enabled" } + }, + storageSettings: [ + { type: "LocallyRedundant", datastoreType: "VaultStore" } + ] + }, + tags: { key1: "val1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.beginCreateOrUpdateAndWait( + resourceGroupName, + vaultName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a BackupVault resource belonging to a resource group. + * + * @summary Creates or updates a BackupVault resource belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/PutBackupVaultWithMSI.json + */ +async function createBackupVaultWithMsi() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const parameters: BackupVaultResource = { + identity: { type: "systemAssigned" }, + location: "WestUS", + properties: { + monitoringSettings: { + azureMonitorAlertSettings: { alertsForAllJobFailures: "Enabled" } + }, + storageSettings: [ + { type: "LocallyRedundant", datastoreType: "VaultStore" } + ] + }, + tags: { key1: "val1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.beginCreateOrUpdateAndWait( + resourceGroupName, + vaultName, + parameters + ); + console.log(result); +} + +async function main() { + createBackupVault(); + createBackupVaultWithMsi(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsDeleteSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsDeleteSample.ts new file mode 100644 index 000000000000..dd82a5407f1c --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsDeleteSample.ts @@ -0,0 +1,40 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a BackupVault resource from the resource group. + * + * @summary Deletes a BackupVault resource from the resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/DeleteBackupVault.json + */ +async function deleteBackupVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.delete(resourceGroupName, vaultName); + console.log(result); +} + +async function main() { + deleteBackupVault(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsGetInResourceGroupSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsGetInResourceGroupSample.ts new file mode 100644 index 000000000000..c74daa551012 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsGetInResourceGroupSample.ts @@ -0,0 +1,44 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns resource collection belonging to a resource group. + * + * @summary Returns resource collection belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json + */ +async function getBackupVaultsInResourceGroup() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.backupVaults.listInResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getBackupVaultsInResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsGetInSubscriptionSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsGetInSubscriptionSample.ts new file mode 100644 index 000000000000..ea55a02bff91 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsGetInSubscriptionSample.ts @@ -0,0 +1,40 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns resource collection belonging to a subscription. + * + * @summary Returns resource collection belonging to a subscription. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVaultsInSubscription.json + */ +async function getBackupVaultsInSubscription() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.backupVaults.listInSubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getBackupVaultsInSubscription(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsGetSample.ts new file mode 100644 index 000000000000..821fbda3e070 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsGetSample.ts @@ -0,0 +1,60 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns a resource belonging to a resource group. + * + * @summary Returns a resource belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVault.json + */ +async function getBackupVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.get(resourceGroupName, vaultName); + console.log(result); +} + +/** + * This sample demonstrates how to Returns a resource belonging to a resource group. + * + * @summary Returns a resource belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVaultWithMSI.json + */ +async function getBackupVaultWithMsi() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.get(resourceGroupName, vaultName); + console.log(result); +} + +async function main() { + getBackupVault(); + getBackupVaultWithMsi(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsUpdateSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsUpdateSample.ts new file mode 100644 index 000000000000..776d7427c9e8 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/backupVaultsUpdateSample.ts @@ -0,0 +1,55 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + PatchResourceRequestInput, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @summary Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/PatchBackupVault.json + */ +async function patchBackupVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const parameters: PatchResourceRequestInput = { + properties: { + monitoringSettings: { + azureMonitorAlertSettings: { alertsForAllJobFailures: "Enabled" } + } + }, + tags: { newKey: "newVal" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.beginUpdateAndWait( + resourceGroupName, + vaultName, + parameters + ); + console.log(result); +} + +async function main() { + patchBackupVault(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/dataProtectionCheckFeatureSupportSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/dataProtectionCheckFeatureSupportSample.ts new file mode 100644 index 000000000000..277ef9d2fda6 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/dataProtectionCheckFeatureSupportSample.ts @@ -0,0 +1,48 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + FeatureValidationRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Validates if a feature is supported + * + * @summary Validates if a feature is supported + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/CheckfeatureSupport.json + */ +async function checkAzureVMBackupFeatureSupport() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const location = "WestUS"; + const parameters: FeatureValidationRequest = { + featureType: "DataSourceType", + objectType: "FeatureValidationRequest" + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.dataProtection.checkFeatureSupport( + location, + parameters + ); + console.log(result); +} + +async function main() { + checkAzureVMBackupFeatureSupport(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/dataProtectionOperationsListSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/dataProtectionOperationsListSample.ts new file mode 100644 index 000000000000..67c5bdd7e138 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/dataProtectionOperationsListSample.ts @@ -0,0 +1,40 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns the list of available operations. + * + * @summary Returns the list of available operations. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/Operations/List.json + */ +async function returnsTheListOfSupportedRestOperations() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.dataProtectionOperations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + returnsTheListOfSupportedRestOperations(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/deletedBackupInstancesGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/deletedBackupInstancesGetSample.ts new file mode 100644 index 000000000000..605b29f48076 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/deletedBackupInstancesGetSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a deleted backup instance with name in a backup vault + * + * @summary Gets a deleted backup instance with name in a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json + */ +async function getDeletedBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.deletedBackupInstances.get( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + getDeletedBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/deletedBackupInstancesListSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/deletedBackupInstancesListSample.ts new file mode 100644 index 000000000000..6561fec502c2 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/deletedBackupInstancesListSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets deleted backup instances belonging to a backup vault + * + * @summary Gets deleted backup instances belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json + */ +async function listDeletedBackupInstancesInAVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.deletedBackupInstances.list( + resourceGroupName, + vaultName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listDeletedBackupInstancesInAVault(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/deletedBackupInstancesUndeleteSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/deletedBackupInstancesUndeleteSample.ts new file mode 100644 index 000000000000..7541a75f088c --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/deletedBackupInstancesUndeleteSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json + */ +async function undeleteDeletedBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.deletedBackupInstances.beginUndeleteAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + undeleteDeletedBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/dppResourceGuardProxyDeleteSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/dppResourceGuardProxyDeleteSample.ts new file mode 100644 index 000000000000..3290bea002fb --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/dppResourceGuardProxyDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json + */ +async function deleteResourceGuardProxy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "5e13b949-1218-4d18-8b99-7e12155ec4f7"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "sampleVault"; + const resourceGuardProxyName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.dppResourceGuardProxy.delete( + resourceGroupName, + vaultName, + resourceGuardProxyName + ); + console.log(result); +} + +async function main() { + deleteResourceGuardProxy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/dppResourceGuardProxyGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/dppResourceGuardProxyGetSample.ts new file mode 100644 index 000000000000..aba224a9d7ee --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/dppResourceGuardProxyGetSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json + */ +async function getResourceGuardProxy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "5e13b949-1218-4d18-8b99-7e12155ec4f7"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "sampleVault"; + const resourceGuardProxyName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.dppResourceGuardProxy.get( + resourceGroupName, + vaultName, + resourceGuardProxyName + ); + console.log(result); +} + +async function main() { + getResourceGuardProxy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/dppResourceGuardProxyListSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/dppResourceGuardProxyListSample.ts new file mode 100644 index 000000000000..754379be64bc --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/dppResourceGuardProxyListSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json + */ +async function getResourceGuardProxies() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "5e13b949-1218-4d18-8b99-7e12155ec4f7"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "sampleVault"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.dppResourceGuardProxy.list( + resourceGroupName, + vaultName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getResourceGuardProxies(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/dppResourceGuardProxyPutSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/dppResourceGuardProxyPutSample.ts new file mode 100644 index 000000000000..a27b052cc06a --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/dppResourceGuardProxyPutSample.ts @@ -0,0 +1,55 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ResourceGuardProxyBaseResource, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json + */ +async function createResourceGuardProxy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "5e13b949-1218-4d18-8b99-7e12155ec4f7"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "sampleVault"; + const resourceGuardProxyName = "swaggerExample"; + const parameters: ResourceGuardProxyBaseResource = { + properties: { + resourceGuardResourceId: + "/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.dppResourceGuardProxy.put( + resourceGroupName, + vaultName, + resourceGuardProxyName, + parameters + ); + console.log(result); +} + +async function main() { + createResourceGuardProxy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/dppResourceGuardProxyUnlockDeleteSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/dppResourceGuardProxyUnlockDeleteSample.ts new file mode 100644 index 000000000000..a1bd34d10107 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/dppResourceGuardProxyUnlockDeleteSample.ts @@ -0,0 +1,56 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + UnlockDeleteRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json + */ +async function unlockDeleteResourceGuardProxy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "5e13b949-1218-4d18-8b99-7e12155ec4f7"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "sampleVault"; + const resourceGuardProxyName = "swaggerExample"; + const parameters: UnlockDeleteRequest = { + resourceGuardOperationRequests: [ + "/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource/deleteBackupInstanceRequests/default" + ], + resourceToBeDeleted: + "/subscriptions/5e13b949-1218-4d18-8b99-7e12155ec4f7/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/backupVaults/sampleVault/backupInstances/TestBI9779f4de" + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.dppResourceGuardProxy.unlockDelete( + resourceGroupName, + vaultName, + resourceGuardProxyName, + parameters + ); + console.log(result); +} + +async function main() { + unlockDeleteResourceGuardProxy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/exportJobsOperationResultGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/exportJobsOperationResultGetSample.ts new file mode 100644 index 000000000000..431a3987c823 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/exportJobsOperationResultGetSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized format. + * + * @summary Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized format. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/GetExportJobsOperationResult.json + */ +async function getExportJobsOperationResult() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SwaggerTestRg"; + const vaultName = "NetSDKTestRsVault"; + const operationId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.exportJobsOperationResult.get( + resourceGroupName, + vaultName, + operationId + ); + console.log(result); +} + +async function main() { + getExportJobsOperationResult(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/exportJobsTriggerSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/exportJobsTriggerSample.ts new file mode 100644 index 000000000000..6a09dbf9f3b9 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/exportJobsTriggerSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Triggers export of jobs and returns an OperationID to track. + * + * @summary Triggers export of jobs and returns an OperationID to track. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/TriggerExportJobs.json + */ +async function triggerExportJobs() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SwaggerTestRg"; + const vaultName = "NetSDKTestRsVault"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.exportJobs.beginTriggerAndWait( + resourceGroupName, + vaultName + ); + console.log(result); +} + +async function main() { + triggerExportJobs(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/jobsGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/jobsGetSample.ts new file mode 100644 index 000000000000..09b426a5ee40 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/jobsGetSample.ts @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a job with id in a backup vault + * + * @summary Gets a job with id in a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/GetJob.json + */ +async function getJob() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "62b829ee-7936-40c9-a1c9-47a93f9f3965"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "BugBash1"; + const vaultName = "BugBashVaultForCCYv11"; + const jobId = "3c60cb49-63e8-4b21-b9bd-26277b3fdfae"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.jobs.get(resourceGroupName, vaultName, jobId); + console.log(result); +} + +async function main() { + getJob(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/jobsListSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/jobsListSample.ts new file mode 100644 index 000000000000..8af4d3d1b129 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/jobsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns list of jobs belonging to a backup vault + * + * @summary Returns list of jobs belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/ListJobs.json + */ +async function getJobs() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "62b829ee-7936-40c9-a1c9-47a93f9f3965"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "BugBash1"; + const vaultName = "BugBashVaultForCCYv11"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.jobs.list(resourceGroupName, vaultName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getJobs(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/operationResultGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/operationResultGetSample.ts new file mode 100644 index 000000000000..06b4fc04ba00 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/operationResultGetSample.ts @@ -0,0 +1,40 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the operation result for a resource + * + * @summary Gets the operation result for a resource + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationResult.json + */ +async function getOperationResult() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const operationId = + "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="; + const location = "WestUS"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.operationResult.get(operationId, location); + console.log(result); +} + +async function main() { + getOperationResult(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/operationStatusBackupVaultContextGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/operationStatusBackupVaultContextGetSample.ts new file mode 100644 index 000000000000..be5dda7000e0 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/operationStatusBackupVaultContextGetSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the operation status for an operation over a BackupVault's context. + * + * @summary Gets the operation status for an operation over a BackupVault's context. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatusVaultContext.json + */ +async function getOperationStatus() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const operationId = + "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.operationStatusBackupVaultContext.get( + resourceGroupName, + vaultName, + operationId + ); + console.log(result); +} + +async function main() { + getOperationStatus(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/operationStatusGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/operationStatusGetSample.ts new file mode 100644 index 000000000000..be020b0d6aff --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/operationStatusGetSample.ts @@ -0,0 +1,40 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the operation status for a resource. + * + * @summary Gets the operation status for a resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatus.json + */ +async function getOperationStatus() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const location = "WestUS"; + const operationId = + "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.operationStatus.get(location, operationId); + console.log(result); +} + +async function main() { + getOperationStatus(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/operationStatusResourceGroupContextGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/operationStatusResourceGroupContextGetSample.ts new file mode 100644 index 000000000000..e23d25be7db7 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/operationStatusResourceGroupContextGetSample.ts @@ -0,0 +1,44 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the operation status for an operation over a ResourceGroup's context. + * + * @summary Gets the operation status for an operation over a ResourceGroup's context. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatusRGContext.json + */ +async function getOperationStatus() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const operationId = + "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.operationStatusResourceGroupContext.get( + resourceGroupName, + operationId + ); + console.log(result); +} + +async function main() { + getOperationStatus(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/recoveryPointsGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/recoveryPointsGetSample.ts new file mode 100644 index 000000000000..abe512d15dd9 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/recoveryPointsGetSample.ts @@ -0,0 +1,47 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Recovery Point using recoveryPointId for a Datasource. + * + * @summary Gets a Recovery Point using recoveryPointId for a Datasource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetRecoveryPoint.json + */ +async function getRecoveryPoint() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const recoveryPointId = "7fb2cddd-c5b3-44f6-a0d9-db3c4f9d5f25"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.recoveryPoints.get( + resourceGroupName, + vaultName, + backupInstanceName, + recoveryPointId + ); + console.log(result); +} + +async function main() { + getRecoveryPoint(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/recoveryPointsListSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/recoveryPointsListSample.ts new file mode 100644 index 000000000000..053684c5d0da --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/recoveryPointsListSample.ts @@ -0,0 +1,48 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns a list of Recovery Points for a DataSource in a vault. + * + * @summary Returns a list of Recovery Points for a DataSource in a vault. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListRecoveryPoints.json + */ +async function listRecoveryPointsInAVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.recoveryPoints.list( + resourceGroupName, + vaultName, + backupInstanceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRecoveryPointsInAVault(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsDeleteSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsDeleteSample.ts new file mode 100644 index 000000000000..c5595edfa0cc --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsDeleteSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a ResourceGuard resource from the resource group. + * + * @summary Deletes a ResourceGuard resource from the resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/DeleteResourceGuard.json + */ +async function deleteResourceGuard() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.delete( + resourceGroupName, + resourceGuardsName + ); + console.log(result); +} + +async function main() { + deleteResourceGuard(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetBackupSecurityPinRequestsObjectsSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetBackupSecurityPinRequestsObjectsSample.ts new file mode 100644 index 000000000000..87055d4c9fa0 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetBackupSecurityPinRequestsObjectsSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listBackupSecurityPINRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultBackupSecurityPinRequestsObjectSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultBackupSecurityPinRequestsObjectSample.ts new file mode 100644 index 000000000000..ce45d7b79de5 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultBackupSecurityPinRequestsObjectSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultBackupSecurityPINRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultDeleteProtectedItemRequestsObjectSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultDeleteProtectedItemRequestsObjectSample.ts new file mode 100644 index 000000000000..1f4b79838097 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultDeleteProtectedItemRequestsObjectSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultDeleteProtectedItemRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectSample.ts new file mode 100644 index 000000000000..e72c972c62b9 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultDeleteResourceGuardProxyRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultDisableSoftDeleteRequestsObjectSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultDisableSoftDeleteRequestsObjectSample.ts new file mode 100644 index 000000000000..6b41c6b3e441 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultDisableSoftDeleteRequestsObjectSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultDisableSoftDeleteRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultUpdateProtectedItemRequestsObjectSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultUpdateProtectedItemRequestsObjectSample.ts new file mode 100644 index 000000000000..b410cb392c35 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultUpdateProtectedItemRequestsObjectSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultUpdateProtectedItemRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectSample.ts new file mode 100644 index 000000000000..ee4cbc60b6f9 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultUpdateProtectionPolicyRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDeleteProtectedItemRequestsObjectsSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDeleteProtectedItemRequestsObjectsSample.ts new file mode 100644 index 000000000000..32c66b58b72b --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDeleteProtectedItemRequestsObjectsSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listDeleteProtectedItemRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDeleteResourceGuardProxyRequestsObjectsSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDeleteResourceGuardProxyRequestsObjectsSample.ts new file mode 100644 index 000000000000..85ac3a3e7ee7 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDeleteResourceGuardProxyRequestsObjectsSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listDeleteResourceGuardProxyRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDisableSoftDeleteRequestsObjectsSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDisableSoftDeleteRequestsObjectsSample.ts new file mode 100644 index 000000000000..401ac850a825 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetDisableSoftDeleteRequestsObjectsSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listDisableSoftDeleteRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetResourcesInResourceGroupSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetResourcesInResourceGroupSample.ts new file mode 100644 index 000000000000..57a1880a8883 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetResourcesInResourceGroupSample.ts @@ -0,0 +1,44 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns ResourceGuards collection belonging to a ResourceGroup. + * + * @summary Returns ResourceGuards collection belonging to a ResourceGroup. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json + */ +async function getResourceGuardsInResourceGroup() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listResourcesInResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getResourceGuardsInResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetResourcesInSubscriptionSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetResourcesInSubscriptionSample.ts new file mode 100644 index 000000000000..7697e416fea7 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetResourcesInSubscriptionSample.ts @@ -0,0 +1,40 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns ResourceGuards collection belonging to a subscription. + * + * @summary Returns ResourceGuards collection belonging to a subscription. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json + */ +async function getResourceGuardsInSubscription() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listResourcesInSubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getResourceGuardsInSubscription(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetSample.ts new file mode 100644 index 000000000000..e71ec08a28aa --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns a ResourceGuard belonging to a resource group. + * + * @summary Returns a ResourceGuard belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuard.json + */ +async function getResourceGuard() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.get( + resourceGroupName, + resourceGuardsName + ); + console.log(result); +} + +async function main() { + getResourceGuard(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetUpdateProtectedItemRequestsObjectsSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetUpdateProtectedItemRequestsObjectsSample.ts new file mode 100644 index 000000000000..6428bba128e4 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetUpdateProtectedItemRequestsObjectsSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listUpdateProtectedItemRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetUpdateProtectionPolicyRequestsObjectsSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetUpdateProtectionPolicyRequestsObjectsSample.ts new file mode 100644 index 000000000000..b28f1b017ae2 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsGetUpdateProtectionPolicyRequestsObjectsSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listUpdateProtectionPolicyRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsPatchSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsPatchSample.ts new file mode 100644 index 000000000000..63874fd41831 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsPatchSample.ts @@ -0,0 +1,48 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + PatchResourceRequestInput, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. + * + * @summary Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/PatchResourceGuard.json + */ +async function patchResourceGuard() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const parameters: PatchResourceRequestInput = { tags: { newKey: "newVal" } }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.patch( + resourceGroupName, + resourceGuardsName, + parameters + ); + console.log(result); +} + +async function main() { + patchResourceGuard(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsPutSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsPutSample.ts new file mode 100644 index 000000000000..621ed587bf3e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/resourceGuardsPutSample.ts @@ -0,0 +1,51 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ResourceGuardResource, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a ResourceGuard resource belonging to a resource group. + * + * @summary Creates or updates a ResourceGuard resource belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/PutResourceGuard.json + */ +async function createResourceGuard() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const parameters: ResourceGuardResource = { + location: "WestUS", + tags: { key1: "val1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.put( + resourceGroupName, + resourceGuardsName, + parameters + ); + console.log(result); +} + +async function main() { + createResourceGuard(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples-dev/restorableTimeRangesFindSample.ts b/sdk/dataprotection/arm-dataprotection/samples-dev/restorableTimeRangesFindSample.ts new file mode 100644 index 000000000000..d24d1a021a41 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples-dev/restorableTimeRangesFindSample.ts @@ -0,0 +1,54 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + AzureBackupFindRestorableTimeRangesRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/FindRestorableTimeRanges.json + */ +async function findRestorableTimeRanges() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "Blob-Backup"; + const vaultName = "ZBlobBackupVaultBVTD3"; + const backupInstanceName = "zblobbackuptestsa58"; + const parameters: AzureBackupFindRestorableTimeRangesRequest = { + endTime: "2021-02-24T00:35:17.6829685Z", + sourceDataStoreType: "OperationalStore", + startTime: "2020-10-17T23:28:17.6829685Z" + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.restorableTimeRanges.find( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + findRestorableTimeRanges(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/README.md b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/README.md new file mode 100644 index 000000000000..286c4d70cb47 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/README.md @@ -0,0 +1,182 @@ +# client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [backupInstancesAdhocBackupSample.js][backupinstancesadhocbackupsample] | Trigger adhoc backup x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerBackup.json | +| [backupInstancesCreateOrUpdateSample.js][backupinstancescreateorupdatesample] | Create or update a backup instance in a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/PutBackupInstance.json | +| [backupInstancesDeleteSample.js][backupinstancesdeletesample] | Delete a backup instance in a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/DeleteBackupInstance.json | +| [backupInstancesExtensionRoutingListSample.js][backupinstancesextensionroutinglistsample] | Gets a list backup instances associated with a tracked resource x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListBackupInstancesExtensionRouting.json | +| [backupInstancesGetBackupInstanceOperationResultSample.js][backupinstancesgetbackupinstanceoperationresultsample] | Get result of backup instance creation operation x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetBackupInstanceOperationResult.json | +| [backupInstancesGetSample.js][backupinstancesgetsample] | Gets a backup instance with name in a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetBackupInstance.json | +| [backupInstancesListSample.js][backupinstanceslistsample] | Gets a backup instances belonging to a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListBackupInstances.json | +| [backupInstancesResumeBackupsSample.js][backupinstancesresumebackupssample] | This operation will resume backups for backup instance x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ResumeBackups.json | +| [backupInstancesResumeProtectionSample.js][backupinstancesresumeprotectionsample] | This operation will resume protection for a stopped backup instance x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ResumeProtection.json | +| [backupInstancesStopProtectionSample.js][backupinstancesstopprotectionsample] | This operation will stop protection of a backup instance and data will be held forever x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/StopProtection.json | +| [backupInstancesSuspendBackupsSample.js][backupinstancessuspendbackupssample] | This operation will stop backup for a backup instance and retains the backup data as per the policy (except latest Recovery point, which will be retained forever) x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/SuspendBackups.json | +| [backupInstancesSyncBackupInstanceSample.js][backupinstancessyncbackupinstancesample] | Sync backup instance again in case of failure This action will retry last failed operation and will bring backup instance to valid state x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/SyncBackupInstance.json | +| [backupInstancesTriggerRehydrateSample.js][backupinstancestriggerrehydratesample] | rehydrate recovery point for restore for a BackupInstance x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRehydrate.json | +| [backupInstancesTriggerRestoreSample.js][backupinstancestriggerrestoresample] | Triggers restore for a BackupInstance x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRestore.json | +| [backupInstancesValidateForBackupSample.js][backupinstancesvalidateforbackupsample] | Validate whether adhoc backup will be successful or not x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ValidateForBackup.json | +| [backupInstancesValidateForRestoreSample.js][backupinstancesvalidateforrestoresample] | Validates if Restore can be triggered for a DataSource x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ValidateRestore.json | +| [backupPoliciesCreateOrUpdateSample.js][backuppoliciescreateorupdatesample] | Creates or Updates a backup policy belonging to a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json | +| [backupPoliciesDeleteSample.js][backuppoliciesdeletesample] | Deletes a backup policy belonging to a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/DeleteBackupPolicy.json | +| [backupPoliciesGetSample.js][backuppoliciesgetsample] | Gets a backup policy belonging to a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/GetBackupPolicy.json | +| [backupPoliciesListSample.js][backuppolicieslistsample] | Returns list of backup policies belonging to a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/ListBackupPolicy.json | +| [backupVaultOperationResultsGetSample.js][backupvaultoperationresultsgetsample] | x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetOperationResultPatch.json | +| [backupVaultsCheckNameAvailabilitySample.js][backupvaultschecknameavailabilitysample] | API to check for resource name availability x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/CheckBackupVaultsNameAvailability.json | +| [backupVaultsCreateOrUpdateSample.js][backupvaultscreateorupdatesample] | Creates or updates a BackupVault resource belonging to a resource group. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/PutBackupVault.json | +| [backupVaultsDeleteSample.js][backupvaultsdeletesample] | Deletes a BackupVault resource from the resource group. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/DeleteBackupVault.json | +| [backupVaultsGetInResourceGroupSample.js][backupvaultsgetinresourcegroupsample] | Returns resource collection belonging to a resource group. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json | +| [backupVaultsGetInSubscriptionSample.js][backupvaultsgetinsubscriptionsample] | Returns resource collection belonging to a subscription. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVaultsInSubscription.json | +| [backupVaultsGetSample.js][backupvaultsgetsample] | Returns a resource belonging to a resource group. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVault.json | +| [backupVaultsUpdateSample.js][backupvaultsupdatesample] | Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/PatchBackupVault.json | +| [dataProtectionCheckFeatureSupportSample.js][dataprotectioncheckfeaturesupportsample] | Validates if a feature is supported x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/CheckfeatureSupport.json | +| [dataProtectionOperationsListSample.js][dataprotectionoperationslistsample] | Returns the list of available operations. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/Operations/List.json | +| [deletedBackupInstancesGetSample.js][deletedbackupinstancesgetsample] | Gets a deleted backup instance with name in a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json | +| [deletedBackupInstancesListSample.js][deletedbackupinstanceslistsample] | Gets deleted backup instances belonging to a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json | +| [deletedBackupInstancesUndeleteSample.js][deletedbackupinstancesundeletesample] | x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json | +| [dppResourceGuardProxyDeleteSample.js][dppresourceguardproxydeletesample] | x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json | +| [dppResourceGuardProxyGetSample.js][dppresourceguardproxygetsample] | x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json | +| [dppResourceGuardProxyListSample.js][dppresourceguardproxylistsample] | x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json | +| [dppResourceGuardProxyPutSample.js][dppresourceguardproxyputsample] | x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json | +| [dppResourceGuardProxyUnlockDeleteSample.js][dppresourceguardproxyunlockdeletesample] | x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json | +| [exportJobsOperationResultGetSample.js][exportjobsoperationresultgetsample] | Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized format. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/GetExportJobsOperationResult.json | +| [exportJobsTriggerSample.js][exportjobstriggersample] | Triggers export of jobs and returns an OperationID to track. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/TriggerExportJobs.json | +| [jobsGetSample.js][jobsgetsample] | Gets a job with id in a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/GetJob.json | +| [jobsListSample.js][jobslistsample] | Returns list of jobs belonging to a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/ListJobs.json | +| [operationResultGetSample.js][operationresultgetsample] | Gets the operation result for a resource x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationResult.json | +| [operationStatusBackupVaultContextGetSample.js][operationstatusbackupvaultcontextgetsample] | Gets the operation status for an operation over a BackupVault's context. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatusVaultContext.json | +| [operationStatusGetSample.js][operationstatusgetsample] | Gets the operation status for a resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatus.json | +| [operationStatusResourceGroupContextGetSample.js][operationstatusresourcegroupcontextgetsample] | Gets the operation status for an operation over a ResourceGroup's context. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatusRGContext.json | +| [recoveryPointsGetSample.js][recoverypointsgetsample] | Gets a Recovery Point using recoveryPointId for a Datasource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetRecoveryPoint.json | +| [recoveryPointsListSample.js][recoverypointslistsample] | Returns a list of Recovery Points for a DataSource in a vault. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListRecoveryPoints.json | +| [resourceGuardsDeleteSample.js][resourceguardsdeletesample] | Deletes a ResourceGuard resource from the resource group. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/DeleteResourceGuard.json | +| [resourceGuardsGetBackupSecurityPinRequestsObjectsSample.js][resourceguardsgetbackupsecuritypinrequestsobjectssample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json | +| [resourceGuardsGetDefaultBackupSecurityPinRequestsObjectSample.js][resourceguardsgetdefaultbackupsecuritypinrequestsobjectsample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json | +| [resourceGuardsGetDefaultDeleteProtectedItemRequestsObjectSample.js][resourceguardsgetdefaultdeleteprotecteditemrequestsobjectsample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json | +| [resourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectSample.js][resourceguardsgetdefaultdeleteresourceguardproxyrequestsobjectsample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json | +| [resourceGuardsGetDefaultDisableSoftDeleteRequestsObjectSample.js][resourceguardsgetdefaultdisablesoftdeleterequestsobjectsample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json | +| [resourceGuardsGetDefaultUpdateProtectedItemRequestsObjectSample.js][resourceguardsgetdefaultupdateprotecteditemrequestsobjectsample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json | +| [resourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectSample.js][resourceguardsgetdefaultupdateprotectionpolicyrequestsobjectsample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json | +| [resourceGuardsGetDeleteProtectedItemRequestsObjectsSample.js][resourceguardsgetdeleteprotecteditemrequestsobjectssample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json | +| [resourceGuardsGetDeleteResourceGuardProxyRequestsObjectsSample.js][resourceguardsgetdeleteresourceguardproxyrequestsobjectssample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json | +| [resourceGuardsGetDisableSoftDeleteRequestsObjectsSample.js][resourceguardsgetdisablesoftdeleterequestsobjectssample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json | +| [resourceGuardsGetResourcesInResourceGroupSample.js][resourceguardsgetresourcesinresourcegroupsample] | Returns ResourceGuards collection belonging to a ResourceGroup. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json | +| [resourceGuardsGetResourcesInSubscriptionSample.js][resourceguardsgetresourcesinsubscriptionsample] | Returns ResourceGuards collection belonging to a subscription. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json | +| [resourceGuardsGetSample.js][resourceguardsgetsample] | Returns a ResourceGuard belonging to a resource group. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuard.json | +| [resourceGuardsGetUpdateProtectedItemRequestsObjectsSample.js][resourceguardsgetupdateprotecteditemrequestsobjectssample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json | +| [resourceGuardsGetUpdateProtectionPolicyRequestsObjectsSample.js][resourceguardsgetupdateprotectionpolicyrequestsobjectssample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json | +| [resourceGuardsPatchSample.js][resourceguardspatchsample] | Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/PatchResourceGuard.json | +| [resourceGuardsPutSample.js][resourceguardsputsample] | Creates or updates a ResourceGuard resource belonging to a resource group. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/PutResourceGuard.json | +| [restorableTimeRangesFindSample.js][restorabletimerangesfindsample] | x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/FindRestorableTimeRanges.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node backupInstancesAdhocBackupSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env DATAPROTECTION_SUBSCRIPTION_ID="" DATAPROTECTION_RESOURCE_GROUP="" node backupInstancesAdhocBackupSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[backupinstancesadhocbackupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesAdhocBackupSample.js +[backupinstancescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesCreateOrUpdateSample.js +[backupinstancesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesDeleteSample.js +[backupinstancesextensionroutinglistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesExtensionRoutingListSample.js +[backupinstancesgetbackupinstanceoperationresultsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesGetBackupInstanceOperationResultSample.js +[backupinstancesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesGetSample.js +[backupinstanceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesListSample.js +[backupinstancesresumebackupssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesResumeBackupsSample.js +[backupinstancesresumeprotectionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesResumeProtectionSample.js +[backupinstancesstopprotectionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesStopProtectionSample.js +[backupinstancessuspendbackupssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesSuspendBackupsSample.js +[backupinstancessyncbackupinstancesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesSyncBackupInstanceSample.js +[backupinstancestriggerrehydratesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesTriggerRehydrateSample.js +[backupinstancestriggerrestoresample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesTriggerRestoreSample.js +[backupinstancesvalidateforbackupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesValidateForBackupSample.js +[backupinstancesvalidateforrestoresample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesValidateForRestoreSample.js +[backuppoliciescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupPoliciesCreateOrUpdateSample.js +[backuppoliciesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupPoliciesDeleteSample.js +[backuppoliciesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupPoliciesGetSample.js +[backuppolicieslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupPoliciesListSample.js +[backupvaultoperationresultsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultOperationResultsGetSample.js +[backupvaultschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsCheckNameAvailabilitySample.js +[backupvaultscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsCreateOrUpdateSample.js +[backupvaultsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsDeleteSample.js +[backupvaultsgetinresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsGetInResourceGroupSample.js +[backupvaultsgetinsubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsGetInSubscriptionSample.js +[backupvaultsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsGetSample.js +[backupvaultsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsUpdateSample.js +[dataprotectioncheckfeaturesupportsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dataProtectionCheckFeatureSupportSample.js +[dataprotectionoperationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dataProtectionOperationsListSample.js +[deletedbackupinstancesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/deletedBackupInstancesGetSample.js +[deletedbackupinstanceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/deletedBackupInstancesListSample.js +[deletedbackupinstancesundeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/deletedBackupInstancesUndeleteSample.js +[dppresourceguardproxydeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyDeleteSample.js +[dppresourceguardproxygetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyGetSample.js +[dppresourceguardproxylistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyListSample.js +[dppresourceguardproxyputsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyPutSample.js +[dppresourceguardproxyunlockdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyUnlockDeleteSample.js +[exportjobsoperationresultgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/exportJobsOperationResultGetSample.js +[exportjobstriggersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/exportJobsTriggerSample.js +[jobsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/jobsGetSample.js +[jobslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/jobsListSample.js +[operationresultgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/operationResultGetSample.js +[operationstatusbackupvaultcontextgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/operationStatusBackupVaultContextGetSample.js +[operationstatusgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/operationStatusGetSample.js +[operationstatusresourcegroupcontextgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/operationStatusResourceGroupContextGetSample.js +[recoverypointsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/recoveryPointsGetSample.js +[recoverypointslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/recoveryPointsListSample.js +[resourceguardsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsDeleteSample.js +[resourceguardsgetbackupsecuritypinrequestsobjectssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetBackupSecurityPinRequestsObjectsSample.js +[resourceguardsgetdefaultbackupsecuritypinrequestsobjectsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultBackupSecurityPinRequestsObjectSample.js +[resourceguardsgetdefaultdeleteprotecteditemrequestsobjectsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultDeleteProtectedItemRequestsObjectSample.js +[resourceguardsgetdefaultdeleteresourceguardproxyrequestsobjectsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectSample.js +[resourceguardsgetdefaultdisablesoftdeleterequestsobjectsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultDisableSoftDeleteRequestsObjectSample.js +[resourceguardsgetdefaultupdateprotecteditemrequestsobjectsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultUpdateProtectedItemRequestsObjectSample.js +[resourceguardsgetdefaultupdateprotectionpolicyrequestsobjectsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectSample.js +[resourceguardsgetdeleteprotecteditemrequestsobjectssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDeleteProtectedItemRequestsObjectsSample.js +[resourceguardsgetdeleteresourceguardproxyrequestsobjectssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDeleteResourceGuardProxyRequestsObjectsSample.js +[resourceguardsgetdisablesoftdeleterequestsobjectssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDisableSoftDeleteRequestsObjectsSample.js +[resourceguardsgetresourcesinresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetResourcesInResourceGroupSample.js +[resourceguardsgetresourcesinsubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetResourcesInSubscriptionSample.js +[resourceguardsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetSample.js +[resourceguardsgetupdateprotecteditemrequestsobjectssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetUpdateProtectedItemRequestsObjectsSample.js +[resourceguardsgetupdateprotectionpolicyrequestsobjectssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetUpdateProtectionPolicyRequestsObjectsSample.js +[resourceguardspatchsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsPatchSample.js +[resourceguardsputsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsPutSample.js +[restorabletimerangesfindsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/restorableTimeRangesFindSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-dataprotection?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/dataprotection/arm-dataprotection/README.md diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesAdhocBackupSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesAdhocBackupSample.js new file mode 100644 index 000000000000..5e9954fc4573 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesAdhocBackupSample.js @@ -0,0 +1,48 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Trigger adhoc backup + * + * @summary Trigger adhoc backup + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerBackup.json + */ +async function triggerAdhocBackup() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters = { + backupRuleOptions: { + ruleName: "BackupWeekly", + triggerOption: { retentionTagOverride: "yearly" }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginAdhocBackupAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + triggerAdhocBackup(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesCreateOrUpdateSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesCreateOrUpdateSample.js new file mode 100644 index 000000000000..3e8d81c26f3a --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesCreateOrUpdateSample.js @@ -0,0 +1,91 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or update a backup instance in a backup vault + * + * @summary Create or update a backup instance in a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/PutBackupInstance.json + */ +async function createBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters = { + properties: { + dataSourceInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "Datasource", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + resourceLocation: "", + resourceName: "testdb", + resourceType: "Microsoft.DBforPostgreSQL/servers/databases", + resourceUri: "", + }, + dataSourceSetInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "DatasourceSet", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + resourceLocation: "", + resourceName: "viveksipgtest", + resourceType: "Microsoft.DBforPostgreSQL/servers", + resourceUri: "", + }, + datasourceAuthCredentials: { + objectType: "SecretStoreBasedAuthCredentials", + secretStoreResource: { + secretStoreType: "AzureKeyVault", + uri: "https://samplevault.vault.azure.net/secrets/credentials", + }, + }, + friendlyName: "harshitbi2", + objectType: "BackupInstance", + policyInfo: { + policyId: + "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/Backupvaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1", + policyParameters: { + dataStoreParametersList: [ + { + dataStoreType: "OperationalStore", + objectType: "AzureOperationalStoreParameters", + resourceGroupId: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest", + }, + ], + }, + }, + validationType: "ShallowValidation", + }, + tags: { key1: "val1" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginCreateOrUpdateAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + createBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesDeleteSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesDeleteSample.js new file mode 100644 index 000000000000..35c0852b8ccf --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesDeleteSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Delete a backup instance in a backup vault + * + * @summary Delete a backup instance in a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/DeleteBackupInstance.json + */ +async function deleteBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginDeleteAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + deleteBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesExtensionRoutingListSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesExtensionRoutingListSample.js new file mode 100644 index 000000000000..4b8c7d77db03 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesExtensionRoutingListSample.js @@ -0,0 +1,39 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a list backup instances associated with a tracked resource + * + * @summary Gets a list backup instances associated with a tracked resource + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListBackupInstancesExtensionRouting.json + */ +async function listBackupInstancesAssociatedWithAnAzureResource() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceId = + "subscriptions/36d32b25-3dc7-41b0-bde1-397500644591/resourceGroups/testRG/providers/Microsoft.Compute/disks/testDisk"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.backupInstancesExtensionRouting.list(resourceId)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listBackupInstancesAssociatedWithAnAzureResource(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesGetBackupInstanceOperationResultSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesGetBackupInstanceOperationResultSample.js new file mode 100644 index 000000000000..0d621858ccff --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesGetBackupInstanceOperationResultSample.js @@ -0,0 +1,44 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Get result of backup instance creation operation + * + * @summary Get result of backup instance creation operation + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetBackupInstanceOperationResult.json + */ +async function getBackupInstanceOperationResult() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const backupInstanceName = "testInstance1"; + const operationId = + "YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA=="; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.getBackupInstanceOperationResult( + resourceGroupName, + vaultName, + backupInstanceName, + operationId + ); + console.log(result); +} + +async function main() { + getBackupInstanceOperationResult(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesGetSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesGetSample.js new file mode 100644 index 000000000000..77287a33ecef --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesGetSample.js @@ -0,0 +1,37 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a backup instance with name in a backup vault + * + * @summary Gets a backup instance with name in a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetBackupInstance.json + */ +async function getBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.get(resourceGroupName, vaultName, backupInstanceName); + console.log(result); +} + +async function main() { + getBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesListSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesListSample.js new file mode 100644 index 000000000000..8217773eda6b --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesListSample.js @@ -0,0 +1,39 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a backup instances belonging to a backup vault + * + * @summary Gets a backup instances belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListBackupInstances.json + */ +async function listBackupInstancesInAVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.backupInstances.list(resourceGroupName, vaultName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listBackupInstancesInAVault(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesResumeBackupsSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesResumeBackupsSample.js new file mode 100644 index 000000000000..795abdb51074 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesResumeBackupsSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to This operation will resume backups for backup instance + * + * @summary This operation will resume backups for backup instance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ResumeBackups.json + */ +async function resumeBackups() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginResumeBackupsAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + resumeBackups(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesResumeProtectionSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesResumeProtectionSample.js new file mode 100644 index 000000000000..4c63feef2cb1 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesResumeProtectionSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to This operation will resume protection for a stopped backup instance + * + * @summary This operation will resume protection for a stopped backup instance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ResumeProtection.json + */ +async function resumeProtection() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginResumeProtectionAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + resumeProtection(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesStopProtectionSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesStopProtectionSample.js new file mode 100644 index 000000000000..7aaba4538d3a --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesStopProtectionSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to This operation will stop protection of a backup instance and data will be held forever + * + * @summary This operation will stop protection of a backup instance and data will be held forever + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/StopProtection.json + */ +async function stopProtection() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginStopProtectionAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + stopProtection(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesSuspendBackupsSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesSuspendBackupsSample.js new file mode 100644 index 000000000000..2d7edf2ad6cf --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesSuspendBackupsSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to This operation will stop backup for a backup instance and retains the backup data as per the policy (except latest Recovery point, which will be retained forever) + * + * @summary This operation will stop backup for a backup instance and retains the backup data as per the policy (except latest Recovery point, which will be retained forever) + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/SuspendBackups.json + */ +async function suspendBackups() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginSuspendBackupsAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + suspendBackups(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesSyncBackupInstanceSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesSyncBackupInstanceSample.js new file mode 100644 index 000000000000..620aae7baa56 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesSyncBackupInstanceSample.js @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Sync backup instance again in case of failure +This action will retry last failed operation and will bring backup instance to valid state + * + * @summary Sync backup instance again in case of failure +This action will retry last failed operation and will bring backup instance to valid state + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/SyncBackupInstance.json + */ +async function syncBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const parameters = { syncType: "Default" }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginSyncBackupInstanceAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + syncBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesTriggerRehydrateSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesTriggerRehydrateSample.js new file mode 100644 index 000000000000..1d6d41824bab --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesTriggerRehydrateSample.js @@ -0,0 +1,47 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to rehydrate recovery point for restore for a BackupInstance + * + * @summary rehydrate recovery point for restore for a BackupInstance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRehydrate.json + */ +async function triggerRehydrate() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters = { + recoveryPointId: "hardcodedRP", + rehydrationPriority: "High", + rehydrationRetentionDuration: "7D", + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginTriggerRehydrateAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + triggerRehydrate(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesTriggerRestoreSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesTriggerRestoreSample.js new file mode 100644 index 000000000000..abcdbed1397a --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesTriggerRestoreSample.js @@ -0,0 +1,180 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Triggers restore for a BackupInstance + * + * @summary Triggers restore for a BackupInstance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRestore.json + */ +async function triggerRestore() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters = { + objectType: "AzureBackupRecoveryPointBasedRestoreRequest", + recoveryPointId: "hardcodedRP", + restoreTargetInfo: { + datasourceAuthCredentials: { + objectType: "SecretStoreBasedAuthCredentials", + secretStoreResource: { + secretStoreType: "AzureKeyVault", + uri: "https://samplevault.vault.azure.net/secrets/credentials", + }, + }, + datasourceInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "Datasource", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/targetdb", + resourceLocation: "", + resourceName: "targetdb", + resourceType: "Microsoft.DBforPostgreSQL/servers/databases", + resourceUri: "", + }, + datasourceSetInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "DatasourceSet", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + resourceLocation: "", + resourceName: "viveksipgtest", + resourceType: "Microsoft.DBforPostgreSQL/servers", + resourceUri: "", + }, + objectType: "RestoreTargetInfo", + recoveryOption: "FailIfExists", + restoreLocation: "southeastasia", + }, + sourceDataStoreType: "VaultStore", + sourceResourceId: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginTriggerRestoreAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Triggers restore for a BackupInstance + * + * @summary Triggers restore for a BackupInstance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRestoreAsFiles.json + */ +async function triggerRestoreAsFiles() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters = { + objectType: "AzureBackupRecoveryPointBasedRestoreRequest", + recoveryPointId: "hardcodedRP", + restoreTargetInfo: { + objectType: "RestoreFilesTargetInfo", + recoveryOption: "FailIfExists", + restoreLocation: "southeastasia", + targetDetails: { + filePrefix: "restoredblob", + restoreTargetLocationType: "AzureBlobs", + url: "https://teststorage.blob.core.windows.net/restoretest", + }, + }, + sourceDataStoreType: "VaultStore", + sourceResourceId: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginTriggerRestoreAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Triggers restore for a BackupInstance + * + * @summary Triggers restore for a BackupInstance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRestoreWithRehydration.json + */ +async function triggerRestoreWithRehydration() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters = { + objectType: "AzureBackupRestoreWithRehydrationRequest", + recoveryPointId: "hardcodedRP", + rehydrationPriority: "High", + rehydrationRetentionDuration: "7D", + restoreTargetInfo: { + datasourceInfo: { + datasourceType: "OssDB", + objectType: "Datasource", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + resourceLocation: "", + resourceName: "testdb", + resourceType: "Microsoft.DBforPostgreSQL/servers/databases", + resourceUri: "", + }, + datasourceSetInfo: { + datasourceType: "OssDB", + objectType: "DatasourceSet", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + resourceLocation: "", + resourceName: "viveksipgtest", + resourceType: "Microsoft.DBforPostgreSQL/servers", + resourceUri: "", + }, + objectType: "RestoreTargetInfo", + recoveryOption: "FailIfExists", + restoreLocation: "southeastasia", + }, + sourceDataStoreType: "VaultStore", + sourceResourceId: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginTriggerRestoreAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + triggerRestore(); + triggerRestoreAsFiles(); + triggerRestoreWithRehydration(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesValidateForBackupSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesValidateForBackupSample.js new file mode 100644 index 000000000000..482e0fd18ada --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesValidateForBackupSample.js @@ -0,0 +1,77 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Validate whether adhoc backup will be successful or not + * + * @summary Validate whether adhoc backup will be successful or not + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ValidateForBackup.json + */ +async function validateForBackup() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const parameters = { + backupInstance: { + dataSourceInfo: { + datasourceType: "OssDB", + objectType: "Datasource", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + resourceLocation: "", + resourceName: "testdb", + resourceType: "Microsoft.DBforPostgreSQL/servers/databases", + resourceUri: "", + }, + dataSourceSetInfo: { + datasourceType: "OssDB", + objectType: "DatasourceSet", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + resourceLocation: "", + resourceName: "viveksipgtest", + resourceType: "Microsoft.DBforPostgreSQL/servers", + resourceUri: "", + }, + datasourceAuthCredentials: { + objectType: "SecretStoreBasedAuthCredentials", + secretStoreResource: { + secretStoreType: "AzureKeyVault", + uri: "https://samplevault.vault.azure.net/secrets/credentials", + }, + }, + friendlyName: "harshitbi2", + objectType: "BackupInstance", + policyInfo: { + policyId: + "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/Backupvaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginValidateForBackupAndWait( + resourceGroupName, + vaultName, + parameters + ); + console.log(result); +} + +async function main() { + validateForBackup(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesValidateForRestoreSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesValidateForRestoreSample.js new file mode 100644 index 000000000000..e3a9899a1deb --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupInstancesValidateForRestoreSample.js @@ -0,0 +1,83 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Validates if Restore can be triggered for a DataSource + * + * @summary Validates if Restore can be triggered for a DataSource + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ValidateRestore.json + */ +async function validateRestore() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters = { + restoreRequestObject: { + objectType: "AzureBackupRecoveryPointBasedRestoreRequest", + recoveryPointId: "hardcodedRP", + restoreTargetInfo: { + datasourceAuthCredentials: { + objectType: "SecretStoreBasedAuthCredentials", + secretStoreResource: { + secretStoreType: "AzureKeyVault", + uri: "https://samplevault.vault.azure.net/secrets/credentials", + }, + }, + datasourceInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "Datasource", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/targetdb", + resourceLocation: "", + resourceName: "targetdb", + resourceType: "Microsoft.DBforPostgreSQL/servers/databases", + resourceUri: "", + }, + datasourceSetInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "DatasourceSet", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + resourceLocation: "", + resourceName: "viveksipgtest", + resourceType: "Microsoft.DBforPostgreSQL/servers", + resourceUri: "", + }, + objectType: "RestoreTargetInfo", + recoveryOption: "FailIfExists", + restoreLocation: "southeastasia", + }, + sourceDataStoreType: "VaultStore", + sourceResourceId: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginValidateForRestoreAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + validateRestore(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupPoliciesCreateOrUpdateSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupPoliciesCreateOrUpdateSample.js new file mode 100644 index 000000000000..e204427d4c9e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupPoliciesCreateOrUpdateSample.js @@ -0,0 +1,121 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or Updates a backup policy belonging to a backup vault + * + * @summary Creates or Updates a backup policy belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json + */ +async function createOrUpdateBackupPolicy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PrivatePreviewVault"; + const backupPolicyName = "OSSDBPolicy"; + const parameters = { + properties: { + datasourceTypes: ["OssDB"], + objectType: "BackupPolicy", + policyRules: [ + { + name: "BackupWeekly", + backupParameters: { + backupType: "Full", + objectType: "AzureBackupParams", + }, + dataStore: { + dataStoreType: "VaultStore", + objectType: "DataStoreInfoBase", + }, + objectType: "AzureBackupRule", + trigger: { + objectType: "ScheduleBasedTriggerContext", + schedule: { + repeatingTimeIntervals: ["R/2019-11-20T08:00:00-08:00/P1W"], + }, + taggingCriteria: [ + { + isDefault: true, + tagInfo: { tagName: "Default" }, + taggingPriority: 99, + }, + { + criteria: [ + { + daysOfTheWeek: ["Sunday"], + objectType: "ScheduleBasedBackupCriteria", + scheduleTimes: [new Date("2019-03-01T13:00:00Z")], + }, + ], + isDefault: false, + tagInfo: { tagName: "Weekly" }, + taggingPriority: 20, + }, + ], + }, + }, + { + name: "Default", + isDefault: true, + lifecycles: [ + { + deleteAfter: { + duration: "P1W", + objectType: "AbsoluteDeleteOption", + }, + sourceDataStore: { + dataStoreType: "VaultStore", + objectType: "DataStoreInfoBase", + }, + }, + ], + objectType: "AzureRetentionRule", + }, + { + name: "Weekly", + isDefault: false, + lifecycles: [ + { + deleteAfter: { + duration: "P12W", + objectType: "AbsoluteDeleteOption", + }, + sourceDataStore: { + dataStoreType: "VaultStore", + objectType: "DataStoreInfoBase", + }, + }, + ], + objectType: "AzureRetentionRule", + }, + ], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupPolicies.createOrUpdate( + resourceGroupName, + vaultName, + backupPolicyName, + parameters + ); + console.log(result); +} + +async function main() { + createOrUpdateBackupPolicy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupPoliciesDeleteSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupPoliciesDeleteSample.js new file mode 100644 index 000000000000..f9ec43f83407 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupPoliciesDeleteSample.js @@ -0,0 +1,37 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a backup policy belonging to a backup vault + * + * @summary Deletes a backup policy belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/DeleteBackupPolicy.json + */ +async function deleteBackupPolicy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PrivatePreviewVault"; + const backupPolicyName = "OSSDBPolicy"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupPolicies.delete(resourceGroupName, vaultName, backupPolicyName); + console.log(result); +} + +async function main() { + deleteBackupPolicy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupPoliciesGetSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupPoliciesGetSample.js new file mode 100644 index 000000000000..ab4a40f13006 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupPoliciesGetSample.js @@ -0,0 +1,37 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a backup policy belonging to a backup vault + * + * @summary Gets a backup policy belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/GetBackupPolicy.json + */ +async function getBackupPolicy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PrivatePreviewVault"; + const backupPolicyName = "OSSDBPolicy"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupPolicies.get(resourceGroupName, vaultName, backupPolicyName); + console.log(result); +} + +async function main() { + getBackupPolicy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupPoliciesListSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupPoliciesListSample.js new file mode 100644 index 000000000000..4e2b48fc87e3 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupPoliciesListSample.js @@ -0,0 +1,39 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns list of backup policies belonging to a backup vault + * + * @summary Returns list of backup policies belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/ListBackupPolicy.json + */ +async function listBackupPolicy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PrivatePreviewVault"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.backupPolicies.list(resourceGroupName, vaultName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listBackupPolicy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultOperationResultsGetSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultOperationResultsGetSample.js new file mode 100644 index 000000000000..3e2a11298593 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultOperationResultsGetSample.js @@ -0,0 +1,42 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetOperationResultPatch.json + */ +async function getOperationResultPatch() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const operationId = + "YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA=="; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaultOperationResults.get( + resourceGroupName, + vaultName, + operationId + ); + console.log(result); +} + +async function main() { + getOperationResultPatch(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsCheckNameAvailabilitySample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsCheckNameAvailabilitySample.js new file mode 100644 index 000000000000..1aebf3e1c8f4 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsCheckNameAvailabilitySample.js @@ -0,0 +1,44 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to API to check for resource name availability + * + * @summary API to check for resource name availability + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/CheckBackupVaultsNameAvailability.json + */ +async function checkBackupVaultsNameAvailability() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const location = "westus"; + const parameters = { + name: "swaggerExample", + type: "Microsoft.DataProtection/BackupVaults", + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.checkNameAvailability( + resourceGroupName, + location, + parameters + ); + console.log(result); +} + +async function main() { + checkBackupVaultsNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsCreateOrUpdateSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsCreateOrUpdateSample.js new file mode 100644 index 000000000000..4f8a4f285ee2 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsCreateOrUpdateSample.js @@ -0,0 +1,84 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates a BackupVault resource belonging to a resource group. + * + * @summary Creates or updates a BackupVault resource belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/PutBackupVault.json + */ +async function createBackupVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const parameters = { + identity: { type: "None" }, + location: "WestUS", + properties: { + monitoringSettings: { + azureMonitorAlertSettings: { alertsForAllJobFailures: "Enabled" }, + }, + storageSettings: [{ type: "LocallyRedundant", datastoreType: "VaultStore" }], + }, + tags: { key1: "val1" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.beginCreateOrUpdateAndWait( + resourceGroupName, + vaultName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a BackupVault resource belonging to a resource group. + * + * @summary Creates or updates a BackupVault resource belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/PutBackupVaultWithMSI.json + */ +async function createBackupVaultWithMsi() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const parameters = { + identity: { type: "systemAssigned" }, + location: "WestUS", + properties: { + monitoringSettings: { + azureMonitorAlertSettings: { alertsForAllJobFailures: "Enabled" }, + }, + storageSettings: [{ type: "LocallyRedundant", datastoreType: "VaultStore" }], + }, + tags: { key1: "val1" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.beginCreateOrUpdateAndWait( + resourceGroupName, + vaultName, + parameters + ); + console.log(result); +} + +async function main() { + createBackupVault(); + createBackupVaultWithMsi(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsDeleteSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsDeleteSample.js new file mode 100644 index 000000000000..9d5e1befc3cb --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsDeleteSample.js @@ -0,0 +1,36 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a BackupVault resource from the resource group. + * + * @summary Deletes a BackupVault resource from the resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/DeleteBackupVault.json + */ +async function deleteBackupVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.delete(resourceGroupName, vaultName); + console.log(result); +} + +async function main() { + deleteBackupVault(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsGetInResourceGroupSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsGetInResourceGroupSample.js new file mode 100644 index 000000000000..58f2c094e463 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsGetInResourceGroupSample.js @@ -0,0 +1,38 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns resource collection belonging to a resource group. + * + * @summary Returns resource collection belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json + */ +async function getBackupVaultsInResourceGroup() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.backupVaults.listInResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getBackupVaultsInResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsGetInSubscriptionSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsGetInSubscriptionSample.js new file mode 100644 index 000000000000..b5ea020ef4f1 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsGetInSubscriptionSample.js @@ -0,0 +1,37 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns resource collection belonging to a subscription. + * + * @summary Returns resource collection belonging to a subscription. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVaultsInSubscription.json + */ +async function getBackupVaultsInSubscription() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.backupVaults.listInSubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getBackupVaultsInSubscription(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsGetSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsGetSample.js new file mode 100644 index 000000000000..d79bdf674973 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsGetSample.js @@ -0,0 +1,54 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns a resource belonging to a resource group. + * + * @summary Returns a resource belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVault.json + */ +async function getBackupVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.get(resourceGroupName, vaultName); + console.log(result); +} + +/** + * This sample demonstrates how to Returns a resource belonging to a resource group. + * + * @summary Returns a resource belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVaultWithMSI.json + */ +async function getBackupVaultWithMsi() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.get(resourceGroupName, vaultName); + console.log(result); +} + +async function main() { + getBackupVault(); + getBackupVaultWithMsi(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsUpdateSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsUpdateSample.js new file mode 100644 index 000000000000..26f0875e3828 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/backupVaultsUpdateSample.js @@ -0,0 +1,48 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @summary Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/PatchBackupVault.json + */ +async function patchBackupVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const parameters = { + properties: { + monitoringSettings: { + azureMonitorAlertSettings: { alertsForAllJobFailures: "Enabled" }, + }, + }, + tags: { newKey: "newVal" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.beginUpdateAndWait( + resourceGroupName, + vaultName, + parameters + ); + console.log(result); +} + +async function main() { + patchBackupVault(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dataProtectionCheckFeatureSupportSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dataProtectionCheckFeatureSupportSample.js new file mode 100644 index 000000000000..5fc32bf96947 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dataProtectionCheckFeatureSupportSample.js @@ -0,0 +1,39 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Validates if a feature is supported + * + * @summary Validates if a feature is supported + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/CheckfeatureSupport.json + */ +async function checkAzureVMBackupFeatureSupport() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const location = "WestUS"; + const parameters = { + featureType: "DataSourceType", + objectType: "FeatureValidationRequest", + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.dataProtection.checkFeatureSupport(location, parameters); + console.log(result); +} + +async function main() { + checkAzureVMBackupFeatureSupport(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dataProtectionOperationsListSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dataProtectionOperationsListSample.js new file mode 100644 index 000000000000..56811f34d3c1 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dataProtectionOperationsListSample.js @@ -0,0 +1,37 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns the list of available operations. + * + * @summary Returns the list of available operations. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/Operations/List.json + */ +async function returnsTheListOfSupportedRestOperations() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.dataProtectionOperations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + returnsTheListOfSupportedRestOperations(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/deletedBackupInstancesGetSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/deletedBackupInstancesGetSample.js new file mode 100644 index 000000000000..4c2ebd0c45fd --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/deletedBackupInstancesGetSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a deleted backup instance with name in a backup vault + * + * @summary Gets a deleted backup instance with name in a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json + */ +async function getDeletedBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.deletedBackupInstances.get( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + getDeletedBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/deletedBackupInstancesListSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/deletedBackupInstancesListSample.js new file mode 100644 index 000000000000..db539b658a20 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/deletedBackupInstancesListSample.js @@ -0,0 +1,39 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets deleted backup instances belonging to a backup vault + * + * @summary Gets deleted backup instances belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json + */ +async function listDeletedBackupInstancesInAVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.deletedBackupInstances.list(resourceGroupName, vaultName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listDeletedBackupInstancesInAVault(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/deletedBackupInstancesUndeleteSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/deletedBackupInstancesUndeleteSample.js new file mode 100644 index 000000000000..1988268be948 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/deletedBackupInstancesUndeleteSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json + */ +async function undeleteDeletedBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.deletedBackupInstances.beginUndeleteAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + undeleteDeletedBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyDeleteSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyDeleteSample.js new file mode 100644 index 000000000000..861b7ca2afc0 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyDeleteSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json + */ +async function deleteResourceGuardProxy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "5e13b949-1218-4d18-8b99-7e12155ec4f7"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "sampleVault"; + const resourceGuardProxyName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.dppResourceGuardProxy.delete( + resourceGroupName, + vaultName, + resourceGuardProxyName + ); + console.log(result); +} + +async function main() { + deleteResourceGuardProxy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyGetSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyGetSample.js new file mode 100644 index 000000000000..d75fec7e4cb1 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyGetSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json + */ +async function getResourceGuardProxy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "5e13b949-1218-4d18-8b99-7e12155ec4f7"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "sampleVault"; + const resourceGuardProxyName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.dppResourceGuardProxy.get( + resourceGroupName, + vaultName, + resourceGuardProxyName + ); + console.log(result); +} + +async function main() { + getResourceGuardProxy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyListSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyListSample.js new file mode 100644 index 000000000000..9a3ac8413f0c --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyListSample.js @@ -0,0 +1,39 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json + */ +async function getResourceGuardProxies() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "5e13b949-1218-4d18-8b99-7e12155ec4f7"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "sampleVault"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.dppResourceGuardProxy.list(resourceGroupName, vaultName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getResourceGuardProxies(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyPutSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyPutSample.js new file mode 100644 index 000000000000..fed355138c88 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyPutSample.js @@ -0,0 +1,48 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json + */ +async function createResourceGuardProxy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "5e13b949-1218-4d18-8b99-7e12155ec4f7"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "sampleVault"; + const resourceGuardProxyName = "swaggerExample"; + const parameters = { + properties: { + resourceGuardResourceId: + "/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.dppResourceGuardProxy.put( + resourceGroupName, + vaultName, + resourceGuardProxyName, + parameters + ); + console.log(result); +} + +async function main() { + createResourceGuardProxy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyUnlockDeleteSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyUnlockDeleteSample.js new file mode 100644 index 000000000000..69c00ac7b60b --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/dppResourceGuardProxyUnlockDeleteSample.js @@ -0,0 +1,49 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json + */ +async function unlockDeleteResourceGuardProxy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "5e13b949-1218-4d18-8b99-7e12155ec4f7"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "sampleVault"; + const resourceGuardProxyName = "swaggerExample"; + const parameters = { + resourceGuardOperationRequests: [ + "/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource/deleteBackupInstanceRequests/default", + ], + resourceToBeDeleted: + "/subscriptions/5e13b949-1218-4d18-8b99-7e12155ec4f7/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/backupVaults/sampleVault/backupInstances/TestBI9779f4de", + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.dppResourceGuardProxy.unlockDelete( + resourceGroupName, + vaultName, + resourceGuardProxyName, + parameters + ); + console.log(result); +} + +async function main() { + unlockDeleteResourceGuardProxy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/exportJobsOperationResultGetSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/exportJobsOperationResultGetSample.js new file mode 100644 index 000000000000..a651619766da --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/exportJobsOperationResultGetSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized format. + * + * @summary Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized format. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/GetExportJobsOperationResult.json + */ +async function getExportJobsOperationResult() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SwaggerTestRg"; + const vaultName = "NetSDKTestRsVault"; + const operationId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.exportJobsOperationResult.get( + resourceGroupName, + vaultName, + operationId + ); + console.log(result); +} + +async function main() { + getExportJobsOperationResult(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/exportJobsTriggerSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/exportJobsTriggerSample.js new file mode 100644 index 000000000000..db30aeb141c5 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/exportJobsTriggerSample.js @@ -0,0 +1,36 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Triggers export of jobs and returns an OperationID to track. + * + * @summary Triggers export of jobs and returns an OperationID to track. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/TriggerExportJobs.json + */ +async function triggerExportJobs() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SwaggerTestRg"; + const vaultName = "NetSDKTestRsVault"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.exportJobs.beginTriggerAndWait(resourceGroupName, vaultName); + console.log(result); +} + +async function main() { + triggerExportJobs(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/jobsGetSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/jobsGetSample.js new file mode 100644 index 000000000000..1888875ddd68 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/jobsGetSample.js @@ -0,0 +1,37 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a job with id in a backup vault + * + * @summary Gets a job with id in a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/GetJob.json + */ +async function getJob() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "62b829ee-7936-40c9-a1c9-47a93f9f3965"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "BugBash1"; + const vaultName = "BugBashVaultForCCYv11"; + const jobId = "3c60cb49-63e8-4b21-b9bd-26277b3fdfae"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.jobs.get(resourceGroupName, vaultName, jobId); + console.log(result); +} + +async function main() { + getJob(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/jobsListSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/jobsListSample.js new file mode 100644 index 000000000000..f2e6b20c723d --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/jobsListSample.js @@ -0,0 +1,39 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns list of jobs belonging to a backup vault + * + * @summary Returns list of jobs belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/ListJobs.json + */ +async function getJobs() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "62b829ee-7936-40c9-a1c9-47a93f9f3965"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "BugBash1"; + const vaultName = "BugBashVaultForCCYv11"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.jobs.list(resourceGroupName, vaultName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getJobs(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/operationResultGetSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/operationResultGetSample.js new file mode 100644 index 000000000000..6b4e391d4dfc --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/operationResultGetSample.js @@ -0,0 +1,37 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the operation result for a resource + * + * @summary Gets the operation result for a resource + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationResult.json + */ +async function getOperationResult() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const operationId = + "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="; + const location = "WestUS"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.operationResult.get(operationId, location); + console.log(result); +} + +async function main() { + getOperationResult(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/operationStatusBackupVaultContextGetSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/operationStatusBackupVaultContextGetSample.js new file mode 100644 index 000000000000..79a633c14978 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/operationStatusBackupVaultContextGetSample.js @@ -0,0 +1,42 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the operation status for an operation over a BackupVault's context. + * + * @summary Gets the operation status for an operation over a BackupVault's context. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatusVaultContext.json + */ +async function getOperationStatus() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const operationId = + "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.operationStatusBackupVaultContext.get( + resourceGroupName, + vaultName, + operationId + ); + console.log(result); +} + +async function main() { + getOperationStatus(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/operationStatusGetSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/operationStatusGetSample.js new file mode 100644 index 000000000000..dc7498cf4e2d --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/operationStatusGetSample.js @@ -0,0 +1,37 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the operation status for a resource. + * + * @summary Gets the operation status for a resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatus.json + */ +async function getOperationStatus() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const location = "WestUS"; + const operationId = + "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.operationStatus.get(location, operationId); + console.log(result); +} + +async function main() { + getOperationStatus(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/operationStatusResourceGroupContextGetSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/operationStatusResourceGroupContextGetSample.js new file mode 100644 index 000000000000..1d091a3efa6f --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/operationStatusResourceGroupContextGetSample.js @@ -0,0 +1,40 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the operation status for an operation over a ResourceGroup's context. + * + * @summary Gets the operation status for an operation over a ResourceGroup's context. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatusRGContext.json + */ +async function getOperationStatus() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const operationId = + "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.operationStatusResourceGroupContext.get( + resourceGroupName, + operationId + ); + console.log(result); +} + +async function main() { + getOperationStatus(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/package.json b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/package.json new file mode 100644 index 000000000000..d4a1a11c3721 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-dataprotection-js-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript (Beta)", + "engines": { + "node": ">=14.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/dataprotection/arm-dataprotection" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/dataprotection/arm-dataprotection", + "dependencies": { + "@azure/arm-dataprotection": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/recoveryPointsGetSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/recoveryPointsGetSample.js new file mode 100644 index 000000000000..32f974d4d595 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/recoveryPointsGetSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a Recovery Point using recoveryPointId for a Datasource. + * + * @summary Gets a Recovery Point using recoveryPointId for a Datasource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetRecoveryPoint.json + */ +async function getRecoveryPoint() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const recoveryPointId = "7fb2cddd-c5b3-44f6-a0d9-db3c4f9d5f25"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.recoveryPoints.get( + resourceGroupName, + vaultName, + backupInstanceName, + recoveryPointId + ); + console.log(result); +} + +async function main() { + getRecoveryPoint(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/recoveryPointsListSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/recoveryPointsListSample.js new file mode 100644 index 000000000000..9983bfba182d --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/recoveryPointsListSample.js @@ -0,0 +1,44 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns a list of Recovery Points for a DataSource in a vault. + * + * @summary Returns a list of Recovery Points for a DataSource in a vault. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListRecoveryPoints.json + */ +async function listRecoveryPointsInAVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.recoveryPoints.list( + resourceGroupName, + vaultName, + backupInstanceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRecoveryPointsInAVault(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsDeleteSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsDeleteSample.js new file mode 100644 index 000000000000..899df4884f18 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsDeleteSample.js @@ -0,0 +1,36 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a ResourceGuard resource from the resource group. + * + * @summary Deletes a ResourceGuard resource from the resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/DeleteResourceGuard.json + */ +async function deleteResourceGuard() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.delete(resourceGroupName, resourceGuardsName); + console.log(result); +} + +async function main() { + deleteResourceGuard(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetBackupSecurityPinRequestsObjectsSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetBackupSecurityPinRequestsObjectsSample.js new file mode 100644 index 000000000000..1c83eca91844 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetBackupSecurityPinRequestsObjectsSample.js @@ -0,0 +1,42 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listBackupSecurityPINRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultBackupSecurityPinRequestsObjectSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultBackupSecurityPinRequestsObjectSample.js new file mode 100644 index 000000000000..2b5db1ce78f2 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultBackupSecurityPinRequestsObjectSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultBackupSecurityPINRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultDeleteProtectedItemRequestsObjectSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultDeleteProtectedItemRequestsObjectSample.js new file mode 100644 index 000000000000..659fcc279d2e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultDeleteProtectedItemRequestsObjectSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultDeleteProtectedItemRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectSample.js new file mode 100644 index 000000000000..9dbd1fe2c7ec --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultDeleteResourceGuardProxyRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultDisableSoftDeleteRequestsObjectSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultDisableSoftDeleteRequestsObjectSample.js new file mode 100644 index 000000000000..ff4837977019 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultDisableSoftDeleteRequestsObjectSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultDisableSoftDeleteRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultUpdateProtectedItemRequestsObjectSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultUpdateProtectedItemRequestsObjectSample.js new file mode 100644 index 000000000000..be91f260ac9e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultUpdateProtectedItemRequestsObjectSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultUpdateProtectedItemRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectSample.js new file mode 100644 index 000000000000..415597e55c48 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultUpdateProtectionPolicyRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDeleteProtectedItemRequestsObjectsSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDeleteProtectedItemRequestsObjectsSample.js new file mode 100644 index 000000000000..9446a5350dbd --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDeleteProtectedItemRequestsObjectsSample.js @@ -0,0 +1,42 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listDeleteProtectedItemRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDeleteResourceGuardProxyRequestsObjectsSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDeleteResourceGuardProxyRequestsObjectsSample.js new file mode 100644 index 000000000000..6d3f48aee4a2 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDeleteResourceGuardProxyRequestsObjectsSample.js @@ -0,0 +1,42 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listDeleteResourceGuardProxyRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDisableSoftDeleteRequestsObjectsSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDisableSoftDeleteRequestsObjectsSample.js new file mode 100644 index 000000000000..7025d1200bd6 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetDisableSoftDeleteRequestsObjectsSample.js @@ -0,0 +1,42 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listDisableSoftDeleteRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetResourcesInResourceGroupSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetResourcesInResourceGroupSample.js new file mode 100644 index 000000000000..2ce41ff7d4f8 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetResourcesInResourceGroupSample.js @@ -0,0 +1,38 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns ResourceGuards collection belonging to a ResourceGroup. + * + * @summary Returns ResourceGuards collection belonging to a ResourceGroup. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json + */ +async function getResourceGuardsInResourceGroup() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listResourcesInResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getResourceGuardsInResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetResourcesInSubscriptionSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetResourcesInSubscriptionSample.js new file mode 100644 index 000000000000..ec59ee8eb564 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetResourcesInSubscriptionSample.js @@ -0,0 +1,37 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns ResourceGuards collection belonging to a subscription. + * + * @summary Returns ResourceGuards collection belonging to a subscription. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json + */ +async function getResourceGuardsInSubscription() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listResourcesInSubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getResourceGuardsInSubscription(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetSample.js new file mode 100644 index 000000000000..bb3396738d6c --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetSample.js @@ -0,0 +1,36 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns a ResourceGuard belonging to a resource group. + * + * @summary Returns a ResourceGuard belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuard.json + */ +async function getResourceGuard() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.get(resourceGroupName, resourceGuardsName); + console.log(result); +} + +async function main() { + getResourceGuard(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetUpdateProtectedItemRequestsObjectsSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetUpdateProtectedItemRequestsObjectsSample.js new file mode 100644 index 000000000000..feadb18768d4 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetUpdateProtectedItemRequestsObjectsSample.js @@ -0,0 +1,42 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listUpdateProtectedItemRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetUpdateProtectionPolicyRequestsObjectsSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetUpdateProtectionPolicyRequestsObjectsSample.js new file mode 100644 index 000000000000..6149aafab9fc --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsGetUpdateProtectionPolicyRequestsObjectsSample.js @@ -0,0 +1,42 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listUpdateProtectionPolicyRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsPatchSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsPatchSample.js new file mode 100644 index 000000000000..04ca42f8a7bb --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsPatchSample.js @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. + * + * @summary Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/PatchResourceGuard.json + */ +async function patchResourceGuard() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const parameters = { tags: { newKey: "newVal" } }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.patch( + resourceGroupName, + resourceGuardsName, + parameters + ); + console.log(result); +} + +async function main() { + patchResourceGuard(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsPutSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsPutSample.js new file mode 100644 index 000000000000..95621e594e64 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/resourceGuardsPutSample.js @@ -0,0 +1,40 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates a ResourceGuard resource belonging to a resource group. + * + * @summary Creates or updates a ResourceGuard resource belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/PutResourceGuard.json + */ +async function createResourceGuard() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const parameters = { + location: "WestUS", + tags: { key1: "val1" }, + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.put(resourceGroupName, resourceGuardsName, parameters); + console.log(result); +} + +async function main() { + createResourceGuard(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/restorableTimeRangesFindSample.js b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/restorableTimeRangesFindSample.js new file mode 100644 index 000000000000..86c037c83fe9 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/restorableTimeRangesFindSample.js @@ -0,0 +1,47 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { DataProtectionClient } = require("@azure/arm-dataprotection"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/FindRestorableTimeRanges.json + */ +async function findRestorableTimeRanges() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = process.env["DATAPROTECTION_RESOURCE_GROUP"] || "Blob-Backup"; + const vaultName = "ZBlobBackupVaultBVTD3"; + const backupInstanceName = "zblobbackuptestsa58"; + const parameters = { + endTime: "2021-02-24T00:35:17.6829685Z", + sourceDataStoreType: "OperationalStore", + startTime: "2020-10-17T23:28:17.6829685Z", + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.restorableTimeRanges.find( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + findRestorableTimeRanges(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/sample.env b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/javascript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/README.md b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/README.md new file mode 100644 index 000000000000..9624eeef1a1a --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/README.md @@ -0,0 +1,195 @@ +# client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [backupInstancesAdhocBackupSample.ts][backupinstancesadhocbackupsample] | Trigger adhoc backup x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerBackup.json | +| [backupInstancesCreateOrUpdateSample.ts][backupinstancescreateorupdatesample] | Create or update a backup instance in a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/PutBackupInstance.json | +| [backupInstancesDeleteSample.ts][backupinstancesdeletesample] | Delete a backup instance in a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/DeleteBackupInstance.json | +| [backupInstancesExtensionRoutingListSample.ts][backupinstancesextensionroutinglistsample] | Gets a list backup instances associated with a tracked resource x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListBackupInstancesExtensionRouting.json | +| [backupInstancesGetBackupInstanceOperationResultSample.ts][backupinstancesgetbackupinstanceoperationresultsample] | Get result of backup instance creation operation x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetBackupInstanceOperationResult.json | +| [backupInstancesGetSample.ts][backupinstancesgetsample] | Gets a backup instance with name in a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetBackupInstance.json | +| [backupInstancesListSample.ts][backupinstanceslistsample] | Gets a backup instances belonging to a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListBackupInstances.json | +| [backupInstancesResumeBackupsSample.ts][backupinstancesresumebackupssample] | This operation will resume backups for backup instance x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ResumeBackups.json | +| [backupInstancesResumeProtectionSample.ts][backupinstancesresumeprotectionsample] | This operation will resume protection for a stopped backup instance x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ResumeProtection.json | +| [backupInstancesStopProtectionSample.ts][backupinstancesstopprotectionsample] | This operation will stop protection of a backup instance and data will be held forever x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/StopProtection.json | +| [backupInstancesSuspendBackupsSample.ts][backupinstancessuspendbackupssample] | This operation will stop backup for a backup instance and retains the backup data as per the policy (except latest Recovery point, which will be retained forever) x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/SuspendBackups.json | +| [backupInstancesSyncBackupInstanceSample.ts][backupinstancessyncbackupinstancesample] | Sync backup instance again in case of failure This action will retry last failed operation and will bring backup instance to valid state x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/SyncBackupInstance.json | +| [backupInstancesTriggerRehydrateSample.ts][backupinstancestriggerrehydratesample] | rehydrate recovery point for restore for a BackupInstance x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRehydrate.json | +| [backupInstancesTriggerRestoreSample.ts][backupinstancestriggerrestoresample] | Triggers restore for a BackupInstance x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRestore.json | +| [backupInstancesValidateForBackupSample.ts][backupinstancesvalidateforbackupsample] | Validate whether adhoc backup will be successful or not x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ValidateForBackup.json | +| [backupInstancesValidateForRestoreSample.ts][backupinstancesvalidateforrestoresample] | Validates if Restore can be triggered for a DataSource x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ValidateRestore.json | +| [backupPoliciesCreateOrUpdateSample.ts][backuppoliciescreateorupdatesample] | Creates or Updates a backup policy belonging to a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json | +| [backupPoliciesDeleteSample.ts][backuppoliciesdeletesample] | Deletes a backup policy belonging to a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/DeleteBackupPolicy.json | +| [backupPoliciesGetSample.ts][backuppoliciesgetsample] | Gets a backup policy belonging to a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/GetBackupPolicy.json | +| [backupPoliciesListSample.ts][backuppolicieslistsample] | Returns list of backup policies belonging to a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/ListBackupPolicy.json | +| [backupVaultOperationResultsGetSample.ts][backupvaultoperationresultsgetsample] | x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetOperationResultPatch.json | +| [backupVaultsCheckNameAvailabilitySample.ts][backupvaultschecknameavailabilitysample] | API to check for resource name availability x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/CheckBackupVaultsNameAvailability.json | +| [backupVaultsCreateOrUpdateSample.ts][backupvaultscreateorupdatesample] | Creates or updates a BackupVault resource belonging to a resource group. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/PutBackupVault.json | +| [backupVaultsDeleteSample.ts][backupvaultsdeletesample] | Deletes a BackupVault resource from the resource group. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/DeleteBackupVault.json | +| [backupVaultsGetInResourceGroupSample.ts][backupvaultsgetinresourcegroupsample] | Returns resource collection belonging to a resource group. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json | +| [backupVaultsGetInSubscriptionSample.ts][backupvaultsgetinsubscriptionsample] | Returns resource collection belonging to a subscription. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVaultsInSubscription.json | +| [backupVaultsGetSample.ts][backupvaultsgetsample] | Returns a resource belonging to a resource group. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVault.json | +| [backupVaultsUpdateSample.ts][backupvaultsupdatesample] | Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/PatchBackupVault.json | +| [dataProtectionCheckFeatureSupportSample.ts][dataprotectioncheckfeaturesupportsample] | Validates if a feature is supported x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/CheckfeatureSupport.json | +| [dataProtectionOperationsListSample.ts][dataprotectionoperationslistsample] | Returns the list of available operations. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/Operations/List.json | +| [deletedBackupInstancesGetSample.ts][deletedbackupinstancesgetsample] | Gets a deleted backup instance with name in a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json | +| [deletedBackupInstancesListSample.ts][deletedbackupinstanceslistsample] | Gets deleted backup instances belonging to a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json | +| [deletedBackupInstancesUndeleteSample.ts][deletedbackupinstancesundeletesample] | x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json | +| [dppResourceGuardProxyDeleteSample.ts][dppresourceguardproxydeletesample] | x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json | +| [dppResourceGuardProxyGetSample.ts][dppresourceguardproxygetsample] | x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json | +| [dppResourceGuardProxyListSample.ts][dppresourceguardproxylistsample] | x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json | +| [dppResourceGuardProxyPutSample.ts][dppresourceguardproxyputsample] | x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json | +| [dppResourceGuardProxyUnlockDeleteSample.ts][dppresourceguardproxyunlockdeletesample] | x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json | +| [exportJobsOperationResultGetSample.ts][exportjobsoperationresultgetsample] | Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized format. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/GetExportJobsOperationResult.json | +| [exportJobsTriggerSample.ts][exportjobstriggersample] | Triggers export of jobs and returns an OperationID to track. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/TriggerExportJobs.json | +| [jobsGetSample.ts][jobsgetsample] | Gets a job with id in a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/GetJob.json | +| [jobsListSample.ts][jobslistsample] | Returns list of jobs belonging to a backup vault x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/ListJobs.json | +| [operationResultGetSample.ts][operationresultgetsample] | Gets the operation result for a resource x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationResult.json | +| [operationStatusBackupVaultContextGetSample.ts][operationstatusbackupvaultcontextgetsample] | Gets the operation status for an operation over a BackupVault's context. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatusVaultContext.json | +| [operationStatusGetSample.ts][operationstatusgetsample] | Gets the operation status for a resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatus.json | +| [operationStatusResourceGroupContextGetSample.ts][operationstatusresourcegroupcontextgetsample] | Gets the operation status for an operation over a ResourceGroup's context. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatusRGContext.json | +| [recoveryPointsGetSample.ts][recoverypointsgetsample] | Gets a Recovery Point using recoveryPointId for a Datasource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetRecoveryPoint.json | +| [recoveryPointsListSample.ts][recoverypointslistsample] | Returns a list of Recovery Points for a DataSource in a vault. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListRecoveryPoints.json | +| [resourceGuardsDeleteSample.ts][resourceguardsdeletesample] | Deletes a ResourceGuard resource from the resource group. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/DeleteResourceGuard.json | +| [resourceGuardsGetBackupSecurityPinRequestsObjectsSample.ts][resourceguardsgetbackupsecuritypinrequestsobjectssample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json | +| [resourceGuardsGetDefaultBackupSecurityPinRequestsObjectSample.ts][resourceguardsgetdefaultbackupsecuritypinrequestsobjectsample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json | +| [resourceGuardsGetDefaultDeleteProtectedItemRequestsObjectSample.ts][resourceguardsgetdefaultdeleteprotecteditemrequestsobjectsample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json | +| [resourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectSample.ts][resourceguardsgetdefaultdeleteresourceguardproxyrequestsobjectsample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json | +| [resourceGuardsGetDefaultDisableSoftDeleteRequestsObjectSample.ts][resourceguardsgetdefaultdisablesoftdeleterequestsobjectsample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json | +| [resourceGuardsGetDefaultUpdateProtectedItemRequestsObjectSample.ts][resourceguardsgetdefaultupdateprotecteditemrequestsobjectsample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json | +| [resourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectSample.ts][resourceguardsgetdefaultupdateprotectionpolicyrequestsobjectsample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json | +| [resourceGuardsGetDeleteProtectedItemRequestsObjectsSample.ts][resourceguardsgetdeleteprotecteditemrequestsobjectssample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json | +| [resourceGuardsGetDeleteResourceGuardProxyRequestsObjectsSample.ts][resourceguardsgetdeleteresourceguardproxyrequestsobjectssample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json | +| [resourceGuardsGetDisableSoftDeleteRequestsObjectsSample.ts][resourceguardsgetdisablesoftdeleterequestsobjectssample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json | +| [resourceGuardsGetResourcesInResourceGroupSample.ts][resourceguardsgetresourcesinresourcegroupsample] | Returns ResourceGuards collection belonging to a ResourceGroup. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json | +| [resourceGuardsGetResourcesInSubscriptionSample.ts][resourceguardsgetresourcesinsubscriptionsample] | Returns ResourceGuards collection belonging to a subscription. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json | +| [resourceGuardsGetSample.ts][resourceguardsgetsample] | Returns a ResourceGuard belonging to a resource group. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuard.json | +| [resourceGuardsGetUpdateProtectedItemRequestsObjectsSample.ts][resourceguardsgetupdateprotecteditemrequestsobjectssample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json | +| [resourceGuardsGetUpdateProtectionPolicyRequestsObjectsSample.ts][resourceguardsgetupdateprotectionpolicyrequestsobjectssample] | Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json | +| [resourceGuardsPatchSample.ts][resourceguardspatchsample] | Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/PatchResourceGuard.json | +| [resourceGuardsPutSample.ts][resourceguardsputsample] | Creates or updates a ResourceGuard resource belonging to a resource group. x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/PutResourceGuard.json | +| [restorableTimeRangesFindSample.ts][restorabletimerangesfindsample] | x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/FindRestorableTimeRanges.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/backupInstancesAdhocBackupSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env DATAPROTECTION_SUBSCRIPTION_ID="" DATAPROTECTION_RESOURCE_GROUP="" node dist/backupInstancesAdhocBackupSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[backupinstancesadhocbackupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesAdhocBackupSample.ts +[backupinstancescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesCreateOrUpdateSample.ts +[backupinstancesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesDeleteSample.ts +[backupinstancesextensionroutinglistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesExtensionRoutingListSample.ts +[backupinstancesgetbackupinstanceoperationresultsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesGetBackupInstanceOperationResultSample.ts +[backupinstancesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesGetSample.ts +[backupinstanceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesListSample.ts +[backupinstancesresumebackupssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesResumeBackupsSample.ts +[backupinstancesresumeprotectionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesResumeProtectionSample.ts +[backupinstancesstopprotectionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesStopProtectionSample.ts +[backupinstancessuspendbackupssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesSuspendBackupsSample.ts +[backupinstancessyncbackupinstancesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesSyncBackupInstanceSample.ts +[backupinstancestriggerrehydratesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesTriggerRehydrateSample.ts +[backupinstancestriggerrestoresample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesTriggerRestoreSample.ts +[backupinstancesvalidateforbackupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesValidateForBackupSample.ts +[backupinstancesvalidateforrestoresample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesValidateForRestoreSample.ts +[backuppoliciescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupPoliciesCreateOrUpdateSample.ts +[backuppoliciesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupPoliciesDeleteSample.ts +[backuppoliciesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupPoliciesGetSample.ts +[backuppolicieslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupPoliciesListSample.ts +[backupvaultoperationresultsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultOperationResultsGetSample.ts +[backupvaultschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsCheckNameAvailabilitySample.ts +[backupvaultscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsCreateOrUpdateSample.ts +[backupvaultsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsDeleteSample.ts +[backupvaultsgetinresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsGetInResourceGroupSample.ts +[backupvaultsgetinsubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsGetInSubscriptionSample.ts +[backupvaultsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsGetSample.ts +[backupvaultsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsUpdateSample.ts +[dataprotectioncheckfeaturesupportsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dataProtectionCheckFeatureSupportSample.ts +[dataprotectionoperationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dataProtectionOperationsListSample.ts +[deletedbackupinstancesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/deletedBackupInstancesGetSample.ts +[deletedbackupinstanceslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/deletedBackupInstancesListSample.ts +[deletedbackupinstancesundeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/deletedBackupInstancesUndeleteSample.ts +[dppresourceguardproxydeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyDeleteSample.ts +[dppresourceguardproxygetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyGetSample.ts +[dppresourceguardproxylistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyListSample.ts +[dppresourceguardproxyputsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyPutSample.ts +[dppresourceguardproxyunlockdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyUnlockDeleteSample.ts +[exportjobsoperationresultgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/exportJobsOperationResultGetSample.ts +[exportjobstriggersample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/exportJobsTriggerSample.ts +[jobsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/jobsGetSample.ts +[jobslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/jobsListSample.ts +[operationresultgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/operationResultGetSample.ts +[operationstatusbackupvaultcontextgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/operationStatusBackupVaultContextGetSample.ts +[operationstatusgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/operationStatusGetSample.ts +[operationstatusresourcegroupcontextgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/operationStatusResourceGroupContextGetSample.ts +[recoverypointsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/recoveryPointsGetSample.ts +[recoverypointslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/recoveryPointsListSample.ts +[resourceguardsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsDeleteSample.ts +[resourceguardsgetbackupsecuritypinrequestsobjectssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetBackupSecurityPinRequestsObjectsSample.ts +[resourceguardsgetdefaultbackupsecuritypinrequestsobjectsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultBackupSecurityPinRequestsObjectSample.ts +[resourceguardsgetdefaultdeleteprotecteditemrequestsobjectsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultDeleteProtectedItemRequestsObjectSample.ts +[resourceguardsgetdefaultdeleteresourceguardproxyrequestsobjectsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectSample.ts +[resourceguardsgetdefaultdisablesoftdeleterequestsobjectsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultDisableSoftDeleteRequestsObjectSample.ts +[resourceguardsgetdefaultupdateprotecteditemrequestsobjectsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultUpdateProtectedItemRequestsObjectSample.ts +[resourceguardsgetdefaultupdateprotectionpolicyrequestsobjectsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectSample.ts +[resourceguardsgetdeleteprotecteditemrequestsobjectssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDeleteProtectedItemRequestsObjectsSample.ts +[resourceguardsgetdeleteresourceguardproxyrequestsobjectssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDeleteResourceGuardProxyRequestsObjectsSample.ts +[resourceguardsgetdisablesoftdeleterequestsobjectssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDisableSoftDeleteRequestsObjectsSample.ts +[resourceguardsgetresourcesinresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetResourcesInResourceGroupSample.ts +[resourceguardsgetresourcesinsubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetResourcesInSubscriptionSample.ts +[resourceguardsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetSample.ts +[resourceguardsgetupdateprotecteditemrequestsobjectssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetUpdateProtectedItemRequestsObjectsSample.ts +[resourceguardsgetupdateprotectionpolicyrequestsobjectssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetUpdateProtectionPolicyRequestsObjectsSample.ts +[resourceguardspatchsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsPatchSample.ts +[resourceguardsputsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsPutSample.ts +[restorabletimerangesfindsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/restorableTimeRangesFindSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-dataprotection?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/dataprotection/arm-dataprotection/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/package.json b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/package.json new file mode 100644 index 000000000000..8d52e9f6ef46 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-dataprotection-ts-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript (Beta)", + "engines": { + "node": ">=14.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/dataprotection/arm-dataprotection" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/dataprotection/arm-dataprotection", + "dependencies": { + "@azure/arm-dataprotection": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^14.0.0", + "typescript": "~4.8.0", + "rimraf": "latest" + } +} diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/sample.env b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesAdhocBackupSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesAdhocBackupSample.ts new file mode 100644 index 000000000000..532aaf55babd --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesAdhocBackupSample.ts @@ -0,0 +1,55 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + TriggerBackupRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Trigger adhoc backup + * + * @summary Trigger adhoc backup + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerBackup.json + */ +async function triggerAdhocBackup() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters: TriggerBackupRequest = { + backupRuleOptions: { + ruleName: "BackupWeekly", + triggerOption: { retentionTagOverride: "yearly" } + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginAdhocBackupAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + triggerAdhocBackup(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesCreateOrUpdateSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..50da49858bc6 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesCreateOrUpdateSample.ts @@ -0,0 +1,98 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + BackupInstanceResource, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update a backup instance in a backup vault + * + * @summary Create or update a backup instance in a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/PutBackupInstance.json + */ +async function createBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters: BackupInstanceResource = { + properties: { + dataSourceInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "Datasource", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + resourceLocation: "", + resourceName: "testdb", + resourceType: "Microsoft.DBforPostgreSQL/servers/databases", + resourceUri: "" + }, + dataSourceSetInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "DatasourceSet", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + resourceLocation: "", + resourceName: "viveksipgtest", + resourceType: "Microsoft.DBforPostgreSQL/servers", + resourceUri: "" + }, + datasourceAuthCredentials: { + objectType: "SecretStoreBasedAuthCredentials", + secretStoreResource: { + secretStoreType: "AzureKeyVault", + uri: "https://samplevault.vault.azure.net/secrets/credentials" + } + }, + friendlyName: "harshitbi2", + objectType: "BackupInstance", + policyInfo: { + policyId: + "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/Backupvaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1", + policyParameters: { + dataStoreParametersList: [ + { + dataStoreType: "OperationalStore", + objectType: "AzureOperationalStoreParameters", + resourceGroupId: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest" + } + ] + } + }, + validationType: "ShallowValidation" + }, + tags: { key1: "val1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginCreateOrUpdateAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + createBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesDeleteSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesDeleteSample.ts new file mode 100644 index 000000000000..f8e337251de3 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Delete a backup instance in a backup vault + * + * @summary Delete a backup instance in a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/DeleteBackupInstance.json + */ +async function deleteBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginDeleteAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + deleteBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesExtensionRoutingListSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesExtensionRoutingListSample.ts new file mode 100644 index 000000000000..0e29cf09d89e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesExtensionRoutingListSample.ts @@ -0,0 +1,44 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a list backup instances associated with a tracked resource + * + * @summary Gets a list backup instances associated with a tracked resource + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListBackupInstancesExtensionRouting.json + */ +async function listBackupInstancesAssociatedWithAnAzureResource() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceId = + "subscriptions/36d32b25-3dc7-41b0-bde1-397500644591/resourceGroups/testRG/providers/Microsoft.Compute/disks/testDisk"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.backupInstancesExtensionRouting.list( + resourceId + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listBackupInstancesAssociatedWithAnAzureResource(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesGetBackupInstanceOperationResultSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesGetBackupInstanceOperationResultSample.ts new file mode 100644 index 000000000000..3a2aa5d55342 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesGetBackupInstanceOperationResultSample.ts @@ -0,0 +1,48 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Get result of backup instance creation operation + * + * @summary Get result of backup instance creation operation + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetBackupInstanceOperationResult.json + */ +async function getBackupInstanceOperationResult() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const backupInstanceName = "testInstance1"; + const operationId = + "YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA=="; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.getBackupInstanceOperationResult( + resourceGroupName, + vaultName, + backupInstanceName, + operationId + ); + console.log(result); +} + +async function main() { + getBackupInstanceOperationResult(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesGetSample.ts new file mode 100644 index 000000000000..1cd542765f99 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesGetSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a backup instance with name in a backup vault + * + * @summary Gets a backup instance with name in a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetBackupInstance.json + */ +async function getBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.get( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + getBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesListSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesListSample.ts new file mode 100644 index 000000000000..7eabf09dadb3 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesListSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a backup instances belonging to a backup vault + * + * @summary Gets a backup instances belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListBackupInstances.json + */ +async function listBackupInstancesInAVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.backupInstances.list( + resourceGroupName, + vaultName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listBackupInstancesInAVault(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesResumeBackupsSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesResumeBackupsSample.ts new file mode 100644 index 000000000000..2bd881a71f9e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesResumeBackupsSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to This operation will resume backups for backup instance + * + * @summary This operation will resume backups for backup instance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ResumeBackups.json + */ +async function resumeBackups() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginResumeBackupsAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + resumeBackups(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesResumeProtectionSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesResumeProtectionSample.ts new file mode 100644 index 000000000000..188fcfe4221c --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesResumeProtectionSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to This operation will resume protection for a stopped backup instance + * + * @summary This operation will resume protection for a stopped backup instance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ResumeProtection.json + */ +async function resumeProtection() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginResumeProtectionAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + resumeProtection(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesStopProtectionSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesStopProtectionSample.ts new file mode 100644 index 000000000000..e03836194e42 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesStopProtectionSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to This operation will stop protection of a backup instance and data will be held forever + * + * @summary This operation will stop protection of a backup instance and data will be held forever + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/StopProtection.json + */ +async function stopProtection() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginStopProtectionAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + stopProtection(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesSuspendBackupsSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesSuspendBackupsSample.ts new file mode 100644 index 000000000000..5c5468780fad --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesSuspendBackupsSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to This operation will stop backup for a backup instance and retains the backup data as per the policy (except latest Recovery point, which will be retained forever) + * + * @summary This operation will stop backup for a backup instance and retains the backup data as per the policy (except latest Recovery point, which will be retained forever) + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/SuspendBackups.json + */ +async function suspendBackups() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginSuspendBackupsAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + suspendBackups(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesSyncBackupInstanceSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesSyncBackupInstanceSample.ts new file mode 100644 index 000000000000..281cacdd3950 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesSyncBackupInstanceSample.ts @@ -0,0 +1,52 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + SyncBackupInstanceRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Sync backup instance again in case of failure +This action will retry last failed operation and will bring backup instance to valid state + * + * @summary Sync backup instance again in case of failure +This action will retry last failed operation and will bring backup instance to valid state + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/SyncBackupInstance.json + */ +async function syncBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const parameters: SyncBackupInstanceRequest = { syncType: "Default" }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginSyncBackupInstanceAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + syncBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesTriggerRehydrateSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesTriggerRehydrateSample.ts new file mode 100644 index 000000000000..4c69ceeff3bb --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesTriggerRehydrateSample.ts @@ -0,0 +1,54 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + AzureBackupRehydrationRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to rehydrate recovery point for restore for a BackupInstance + * + * @summary rehydrate recovery point for restore for a BackupInstance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRehydrate.json + */ +async function triggerRehydrate() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters: AzureBackupRehydrationRequest = { + recoveryPointId: "hardcodedRP", + rehydrationPriority: "High", + rehydrationRetentionDuration: "7D" + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginTriggerRehydrateAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + triggerRehydrate(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesTriggerRestoreSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesTriggerRestoreSample.ts new file mode 100644 index 000000000000..a22bb9521d4e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesTriggerRestoreSample.ts @@ -0,0 +1,192 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + AzureBackupRecoveryPointBasedRestoreRequestUnion, + AzureBackupRestoreWithRehydrationRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Triggers restore for a BackupInstance + * + * @summary Triggers restore for a BackupInstance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRestore.json + */ +async function triggerRestore() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters: AzureBackupRecoveryPointBasedRestoreRequestUnion = { + objectType: "AzureBackupRecoveryPointBasedRestoreRequest", + recoveryPointId: "hardcodedRP", + restoreTargetInfo: { + datasourceAuthCredentials: { + objectType: "SecretStoreBasedAuthCredentials", + secretStoreResource: { + secretStoreType: "AzureKeyVault", + uri: "https://samplevault.vault.azure.net/secrets/credentials" + } + }, + datasourceInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "Datasource", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/targetdb", + resourceLocation: "", + resourceName: "targetdb", + resourceType: "Microsoft.DBforPostgreSQL/servers/databases", + resourceUri: "" + }, + datasourceSetInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "DatasourceSet", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + resourceLocation: "", + resourceName: "viveksipgtest", + resourceType: "Microsoft.DBforPostgreSQL/servers", + resourceUri: "" + }, + objectType: "RestoreTargetInfo", + recoveryOption: "FailIfExists", + restoreLocation: "southeastasia" + }, + sourceDataStoreType: "VaultStore", + sourceResourceId: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb" + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginTriggerRestoreAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Triggers restore for a BackupInstance + * + * @summary Triggers restore for a BackupInstance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRestoreAsFiles.json + */ +async function triggerRestoreAsFiles() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters: AzureBackupRecoveryPointBasedRestoreRequestUnion = { + objectType: "AzureBackupRecoveryPointBasedRestoreRequest", + recoveryPointId: "hardcodedRP", + restoreTargetInfo: { + objectType: "RestoreFilesTargetInfo", + recoveryOption: "FailIfExists", + restoreLocation: "southeastasia", + targetDetails: { + filePrefix: "restoredblob", + restoreTargetLocationType: "AzureBlobs", + url: "https://teststorage.blob.core.windows.net/restoretest" + } + }, + sourceDataStoreType: "VaultStore", + sourceResourceId: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb" + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginTriggerRestoreAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Triggers restore for a BackupInstance + * + * @summary Triggers restore for a BackupInstance + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/TriggerRestoreWithRehydration.json + */ +async function triggerRestoreWithRehydration() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters: AzureBackupRestoreWithRehydrationRequest = { + objectType: "AzureBackupRestoreWithRehydrationRequest", + recoveryPointId: "hardcodedRP", + rehydrationPriority: "High", + rehydrationRetentionDuration: "7D", + restoreTargetInfo: { + datasourceInfo: { + datasourceType: "OssDB", + objectType: "Datasource", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + resourceLocation: "", + resourceName: "testdb", + resourceType: "Microsoft.DBforPostgreSQL/servers/databases", + resourceUri: "" + }, + datasourceSetInfo: { + datasourceType: "OssDB", + objectType: "DatasourceSet", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + resourceLocation: "", + resourceName: "viveksipgtest", + resourceType: "Microsoft.DBforPostgreSQL/servers", + resourceUri: "" + }, + objectType: "RestoreTargetInfo", + recoveryOption: "FailIfExists", + restoreLocation: "southeastasia" + }, + sourceDataStoreType: "VaultStore", + sourceResourceId: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb" + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginTriggerRestoreAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + triggerRestore(); + triggerRestoreAsFiles(); + triggerRestoreWithRehydration(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesValidateForBackupSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesValidateForBackupSample.ts new file mode 100644 index 000000000000..fbc342d18395 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesValidateForBackupSample.ts @@ -0,0 +1,84 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ValidateForBackupRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Validate whether adhoc backup will be successful or not + * + * @summary Validate whether adhoc backup will be successful or not + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ValidateForBackup.json + */ +async function validateForBackup() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const parameters: ValidateForBackupRequest = { + backupInstance: { + dataSourceInfo: { + datasourceType: "OssDB", + objectType: "Datasource", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + resourceLocation: "", + resourceName: "testdb", + resourceType: "Microsoft.DBforPostgreSQL/servers/databases", + resourceUri: "" + }, + dataSourceSetInfo: { + datasourceType: "OssDB", + objectType: "DatasourceSet", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + resourceLocation: "", + resourceName: "viveksipgtest", + resourceType: "Microsoft.DBforPostgreSQL/servers", + resourceUri: "" + }, + datasourceAuthCredentials: { + objectType: "SecretStoreBasedAuthCredentials", + secretStoreResource: { + secretStoreType: "AzureKeyVault", + uri: "https://samplevault.vault.azure.net/secrets/credentials" + } + }, + friendlyName: "harshitbi2", + objectType: "BackupInstance", + policyInfo: { + policyId: + "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/Backupvaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginValidateForBackupAndWait( + resourceGroupName, + vaultName, + parameters + ); + console.log(result); +} + +async function main() { + validateForBackup(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesValidateForRestoreSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesValidateForRestoreSample.ts new file mode 100644 index 000000000000..62c2959e5c3f --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupInstancesValidateForRestoreSample.ts @@ -0,0 +1,90 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ValidateRestoreRequestObject, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Validates if Restore can be triggered for a DataSource + * + * @summary Validates if Restore can be triggered for a DataSource + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ValidateRestore.json + */ +async function validateRestore() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const parameters: ValidateRestoreRequestObject = { + restoreRequestObject: { + objectType: "AzureBackupRecoveryPointBasedRestoreRequest", + recoveryPointId: "hardcodedRP", + restoreTargetInfo: { + datasourceAuthCredentials: { + objectType: "SecretStoreBasedAuthCredentials", + secretStoreResource: { + secretStoreType: "AzureKeyVault", + uri: "https://samplevault.vault.azure.net/secrets/credentials" + } + }, + datasourceInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "Datasource", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/targetdb", + resourceLocation: "", + resourceName: "targetdb", + resourceType: "Microsoft.DBforPostgreSQL/servers/databases", + resourceUri: "" + }, + datasourceSetInfo: { + datasourceType: "Microsoft.DBforPostgreSQL/servers/databases", + objectType: "DatasourceSet", + resourceID: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + resourceLocation: "", + resourceName: "viveksipgtest", + resourceType: "Microsoft.DBforPostgreSQL/servers", + resourceUri: "" + }, + objectType: "RestoreTargetInfo", + recoveryOption: "FailIfExists", + restoreLocation: "southeastasia" + }, + sourceDataStoreType: "VaultStore", + sourceResourceId: + "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupInstances.beginValidateForRestoreAndWait( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + validateRestore(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupPoliciesCreateOrUpdateSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupPoliciesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..fa10b5855792 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupPoliciesCreateOrUpdateSample.ts @@ -0,0 +1,128 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + BaseBackupPolicyResource, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or Updates a backup policy belonging to a backup vault + * + * @summary Creates or Updates a backup policy belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json + */ +async function createOrUpdateBackupPolicy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PrivatePreviewVault"; + const backupPolicyName = "OSSDBPolicy"; + const parameters: BaseBackupPolicyResource = { + properties: { + datasourceTypes: ["OssDB"], + objectType: "BackupPolicy", + policyRules: [ + { + name: "BackupWeekly", + backupParameters: { + backupType: "Full", + objectType: "AzureBackupParams" + }, + dataStore: { + dataStoreType: "VaultStore", + objectType: "DataStoreInfoBase" + }, + objectType: "AzureBackupRule", + trigger: { + objectType: "ScheduleBasedTriggerContext", + schedule: { + repeatingTimeIntervals: ["R/2019-11-20T08:00:00-08:00/P1W"] + }, + taggingCriteria: [ + { + isDefault: true, + tagInfo: { tagName: "Default" }, + taggingPriority: 99 + }, + { + criteria: [ + { + daysOfTheWeek: ["Sunday"], + objectType: "ScheduleBasedBackupCriteria", + scheduleTimes: [new Date("2019-03-01T13:00:00Z")] + } + ], + isDefault: false, + tagInfo: { tagName: "Weekly" }, + taggingPriority: 20 + } + ] + } + }, + { + name: "Default", + isDefault: true, + lifecycles: [ + { + deleteAfter: { + duration: "P1W", + objectType: "AbsoluteDeleteOption" + }, + sourceDataStore: { + dataStoreType: "VaultStore", + objectType: "DataStoreInfoBase" + } + } + ], + objectType: "AzureRetentionRule" + }, + { + name: "Weekly", + isDefault: false, + lifecycles: [ + { + deleteAfter: { + duration: "P12W", + objectType: "AbsoluteDeleteOption" + }, + sourceDataStore: { + dataStoreType: "VaultStore", + objectType: "DataStoreInfoBase" + } + } + ], + objectType: "AzureRetentionRule" + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupPolicies.createOrUpdate( + resourceGroupName, + vaultName, + backupPolicyName, + parameters + ); + console.log(result); +} + +async function main() { + createOrUpdateBackupPolicy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupPoliciesDeleteSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupPoliciesDeleteSample.ts new file mode 100644 index 000000000000..be672bff0a10 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupPoliciesDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a backup policy belonging to a backup vault + * + * @summary Deletes a backup policy belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/DeleteBackupPolicy.json + */ +async function deleteBackupPolicy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PrivatePreviewVault"; + const backupPolicyName = "OSSDBPolicy"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupPolicies.delete( + resourceGroupName, + vaultName, + backupPolicyName + ); + console.log(result); +} + +async function main() { + deleteBackupPolicy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupPoliciesGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupPoliciesGetSample.ts new file mode 100644 index 000000000000..475e0952e7f1 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupPoliciesGetSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a backup policy belonging to a backup vault + * + * @summary Gets a backup policy belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/GetBackupPolicy.json + */ +async function getBackupPolicy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PrivatePreviewVault"; + const backupPolicyName = "OSSDBPolicy"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupPolicies.get( + resourceGroupName, + vaultName, + backupPolicyName + ); + console.log(result); +} + +async function main() { + getBackupPolicy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupPoliciesListSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupPoliciesListSample.ts new file mode 100644 index 000000000000..c955ab890f7e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupPoliciesListSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns list of backup policies belonging to a backup vault + * + * @summary Returns list of backup policies belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/PolicyCRUD/ListBackupPolicy.json + */ +async function listBackupPolicy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PrivatePreviewVault"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.backupPolicies.list( + resourceGroupName, + vaultName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listBackupPolicy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultOperationResultsGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultOperationResultsGetSample.ts new file mode 100644 index 000000000000..89dbda510234 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultOperationResultsGetSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetOperationResultPatch.json + */ +async function getOperationResultPatch() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const operationId = + "YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA=="; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaultOperationResults.get( + resourceGroupName, + vaultName, + operationId + ); + console.log(result); +} + +async function main() { + getOperationResultPatch(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsCheckNameAvailabilitySample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..0eb31a447bf0 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsCheckNameAvailabilitySample.ts @@ -0,0 +1,51 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + CheckNameAvailabilityRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to API to check for resource name availability + * + * @summary API to check for resource name availability + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/CheckBackupVaultsNameAvailability.json + */ +async function checkBackupVaultsNameAvailability() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const location = "westus"; + const parameters: CheckNameAvailabilityRequest = { + name: "swaggerExample", + type: "Microsoft.DataProtection/BackupVaults" + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.checkNameAvailability( + resourceGroupName, + location, + parameters + ); + console.log(result); +} + +async function main() { + checkBackupVaultsNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsCreateOrUpdateSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..807bb70755db --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsCreateOrUpdateSample.ts @@ -0,0 +1,97 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + BackupVaultResource, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a BackupVault resource belonging to a resource group. + * + * @summary Creates or updates a BackupVault resource belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/PutBackupVault.json + */ +async function createBackupVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const parameters: BackupVaultResource = { + identity: { type: "None" }, + location: "WestUS", + properties: { + monitoringSettings: { + azureMonitorAlertSettings: { alertsForAllJobFailures: "Enabled" } + }, + storageSettings: [ + { type: "LocallyRedundant", datastoreType: "VaultStore" } + ] + }, + tags: { key1: "val1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.beginCreateOrUpdateAndWait( + resourceGroupName, + vaultName, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Creates or updates a BackupVault resource belonging to a resource group. + * + * @summary Creates or updates a BackupVault resource belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/PutBackupVaultWithMSI.json + */ +async function createBackupVaultWithMsi() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const parameters: BackupVaultResource = { + identity: { type: "systemAssigned" }, + location: "WestUS", + properties: { + monitoringSettings: { + azureMonitorAlertSettings: { alertsForAllJobFailures: "Enabled" } + }, + storageSettings: [ + { type: "LocallyRedundant", datastoreType: "VaultStore" } + ] + }, + tags: { key1: "val1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.beginCreateOrUpdateAndWait( + resourceGroupName, + vaultName, + parameters + ); + console.log(result); +} + +async function main() { + createBackupVault(); + createBackupVaultWithMsi(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsDeleteSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsDeleteSample.ts new file mode 100644 index 000000000000..dd82a5407f1c --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsDeleteSample.ts @@ -0,0 +1,40 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a BackupVault resource from the resource group. + * + * @summary Deletes a BackupVault resource from the resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/DeleteBackupVault.json + */ +async function deleteBackupVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.delete(resourceGroupName, vaultName); + console.log(result); +} + +async function main() { + deleteBackupVault(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsGetInResourceGroupSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsGetInResourceGroupSample.ts new file mode 100644 index 000000000000..c74daa551012 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsGetInResourceGroupSample.ts @@ -0,0 +1,44 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns resource collection belonging to a resource group. + * + * @summary Returns resource collection belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json + */ +async function getBackupVaultsInResourceGroup() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.backupVaults.listInResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getBackupVaultsInResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsGetInSubscriptionSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsGetInSubscriptionSample.ts new file mode 100644 index 000000000000..ea55a02bff91 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsGetInSubscriptionSample.ts @@ -0,0 +1,40 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns resource collection belonging to a subscription. + * + * @summary Returns resource collection belonging to a subscription. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVaultsInSubscription.json + */ +async function getBackupVaultsInSubscription() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.backupVaults.listInSubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getBackupVaultsInSubscription(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsGetSample.ts new file mode 100644 index 000000000000..821fbda3e070 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsGetSample.ts @@ -0,0 +1,60 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns a resource belonging to a resource group. + * + * @summary Returns a resource belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVault.json + */ +async function getBackupVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.get(resourceGroupName, vaultName); + console.log(result); +} + +/** + * This sample demonstrates how to Returns a resource belonging to a resource group. + * + * @summary Returns a resource belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/GetBackupVaultWithMSI.json + */ +async function getBackupVaultWithMsi() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.get(resourceGroupName, vaultName); + console.log(result); +} + +async function main() { + getBackupVault(); + getBackupVaultWithMsi(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsUpdateSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsUpdateSample.ts new file mode 100644 index 000000000000..776d7427c9e8 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/backupVaultsUpdateSample.ts @@ -0,0 +1,55 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + PatchResourceRequestInput, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * + * @summary Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/VaultCRUD/PatchBackupVault.json + */ +async function patchBackupVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const parameters: PatchResourceRequestInput = { + properties: { + monitoringSettings: { + azureMonitorAlertSettings: { alertsForAllJobFailures: "Enabled" } + } + }, + tags: { newKey: "newVal" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.backupVaults.beginUpdateAndWait( + resourceGroupName, + vaultName, + parameters + ); + console.log(result); +} + +async function main() { + patchBackupVault(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dataProtectionCheckFeatureSupportSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dataProtectionCheckFeatureSupportSample.ts new file mode 100644 index 000000000000..277ef9d2fda6 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dataProtectionCheckFeatureSupportSample.ts @@ -0,0 +1,48 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + FeatureValidationRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Validates if a feature is supported + * + * @summary Validates if a feature is supported + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/CheckfeatureSupport.json + */ +async function checkAzureVMBackupFeatureSupport() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const location = "WestUS"; + const parameters: FeatureValidationRequest = { + featureType: "DataSourceType", + objectType: "FeatureValidationRequest" + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.dataProtection.checkFeatureSupport( + location, + parameters + ); + console.log(result); +} + +async function main() { + checkAzureVMBackupFeatureSupport(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dataProtectionOperationsListSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dataProtectionOperationsListSample.ts new file mode 100644 index 000000000000..67c5bdd7e138 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dataProtectionOperationsListSample.ts @@ -0,0 +1,40 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns the list of available operations. + * + * @summary Returns the list of available operations. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/Operations/List.json + */ +async function returnsTheListOfSupportedRestOperations() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.dataProtectionOperations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + returnsTheListOfSupportedRestOperations(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/deletedBackupInstancesGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/deletedBackupInstancesGetSample.ts new file mode 100644 index 000000000000..605b29f48076 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/deletedBackupInstancesGetSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a deleted backup instance with name in a backup vault + * + * @summary Gets a deleted backup instance with name in a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json + */ +async function getDeletedBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.deletedBackupInstances.get( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + getDeletedBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/deletedBackupInstancesListSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/deletedBackupInstancesListSample.ts new file mode 100644 index 000000000000..6561fec502c2 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/deletedBackupInstancesListSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets deleted backup instances belonging to a backup vault + * + * @summary Gets deleted backup instances belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json + */ +async function listDeletedBackupInstancesInAVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.deletedBackupInstances.list( + resourceGroupName, + vaultName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listDeletedBackupInstancesInAVault(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/deletedBackupInstancesUndeleteSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/deletedBackupInstancesUndeleteSample.ts new file mode 100644 index 000000000000..7541a75f088c --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/deletedBackupInstancesUndeleteSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json + */ +async function undeleteDeletedBackupInstance() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "testrg"; + const vaultName = "testvault"; + const backupInstanceName = "testbi"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.deletedBackupInstances.beginUndeleteAndWait( + resourceGroupName, + vaultName, + backupInstanceName + ); + console.log(result); +} + +async function main() { + undeleteDeletedBackupInstance(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyDeleteSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyDeleteSample.ts new file mode 100644 index 000000000000..3290bea002fb --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json + */ +async function deleteResourceGuardProxy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "5e13b949-1218-4d18-8b99-7e12155ec4f7"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "sampleVault"; + const resourceGuardProxyName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.dppResourceGuardProxy.delete( + resourceGroupName, + vaultName, + resourceGuardProxyName + ); + console.log(result); +} + +async function main() { + deleteResourceGuardProxy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyGetSample.ts new file mode 100644 index 000000000000..aba224a9d7ee --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyGetSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json + */ +async function getResourceGuardProxy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "5e13b949-1218-4d18-8b99-7e12155ec4f7"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "sampleVault"; + const resourceGuardProxyName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.dppResourceGuardProxy.get( + resourceGroupName, + vaultName, + resourceGuardProxyName + ); + console.log(result); +} + +async function main() { + getResourceGuardProxy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyListSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyListSample.ts new file mode 100644 index 000000000000..754379be64bc --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyListSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json + */ +async function getResourceGuardProxies() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "5e13b949-1218-4d18-8b99-7e12155ec4f7"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "sampleVault"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.dppResourceGuardProxy.list( + resourceGroupName, + vaultName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getResourceGuardProxies(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyPutSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyPutSample.ts new file mode 100644 index 000000000000..a27b052cc06a --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyPutSample.ts @@ -0,0 +1,55 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ResourceGuardProxyBaseResource, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json + */ +async function createResourceGuardProxy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "5e13b949-1218-4d18-8b99-7e12155ec4f7"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "sampleVault"; + const resourceGuardProxyName = "swaggerExample"; + const parameters: ResourceGuardProxyBaseResource = { + properties: { + resourceGuardResourceId: + "/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource" + } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.dppResourceGuardProxy.put( + resourceGroupName, + vaultName, + resourceGuardProxyName, + parameters + ); + console.log(result); +} + +async function main() { + createResourceGuardProxy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyUnlockDeleteSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyUnlockDeleteSample.ts new file mode 100644 index 000000000000..a1bd34d10107 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/dppResourceGuardProxyUnlockDeleteSample.ts @@ -0,0 +1,56 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + UnlockDeleteRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json + */ +async function unlockDeleteResourceGuardProxy() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "5e13b949-1218-4d18-8b99-7e12155ec4f7"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "sampleVault"; + const resourceGuardProxyName = "swaggerExample"; + const parameters: UnlockDeleteRequest = { + resourceGuardOperationRequests: [ + "/subscriptions/f9e67185-f313-4e79-aa71-6458d429369d/resourceGroups/ResourceGuardSecurityAdminRG/providers/Microsoft.DataProtection/resourceGuards/ResourceGuardTestResource/deleteBackupInstanceRequests/default" + ], + resourceToBeDeleted: + "/subscriptions/5e13b949-1218-4d18-8b99-7e12155ec4f7/resourceGroups/SampleResourceGroup/providers/Microsoft.DataProtection/backupVaults/sampleVault/backupInstances/TestBI9779f4de" + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.dppResourceGuardProxy.unlockDelete( + resourceGroupName, + vaultName, + resourceGuardProxyName, + parameters + ); + console.log(result); +} + +async function main() { + unlockDeleteResourceGuardProxy(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/exportJobsOperationResultGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/exportJobsOperationResultGetSample.ts new file mode 100644 index 000000000000..431a3987c823 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/exportJobsOperationResultGetSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized format. + * + * @summary Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized format. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/GetExportJobsOperationResult.json + */ +async function getExportJobsOperationResult() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SwaggerTestRg"; + const vaultName = "NetSDKTestRsVault"; + const operationId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.exportJobsOperationResult.get( + resourceGroupName, + vaultName, + operationId + ); + console.log(result); +} + +async function main() { + getExportJobsOperationResult(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/exportJobsTriggerSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/exportJobsTriggerSample.ts new file mode 100644 index 000000000000..6a09dbf9f3b9 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/exportJobsTriggerSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Triggers export of jobs and returns an OperationID to track. + * + * @summary Triggers export of jobs and returns an OperationID to track. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/TriggerExportJobs.json + */ +async function triggerExportJobs() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SwaggerTestRg"; + const vaultName = "NetSDKTestRsVault"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.exportJobs.beginTriggerAndWait( + resourceGroupName, + vaultName + ); + console.log(result); +} + +async function main() { + triggerExportJobs(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/jobsGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/jobsGetSample.ts new file mode 100644 index 000000000000..09b426a5ee40 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/jobsGetSample.ts @@ -0,0 +1,41 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a job with id in a backup vault + * + * @summary Gets a job with id in a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/GetJob.json + */ +async function getJob() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "62b829ee-7936-40c9-a1c9-47a93f9f3965"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "BugBash1"; + const vaultName = "BugBashVaultForCCYv11"; + const jobId = "3c60cb49-63e8-4b21-b9bd-26277b3fdfae"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.jobs.get(resourceGroupName, vaultName, jobId); + console.log(result); +} + +async function main() { + getJob(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/jobsListSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/jobsListSample.ts new file mode 100644 index 000000000000..8af4d3d1b129 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/jobsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns list of jobs belonging to a backup vault + * + * @summary Returns list of jobs belonging to a backup vault + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/JobCRUD/ListJobs.json + */ +async function getJobs() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "62b829ee-7936-40c9-a1c9-47a93f9f3965"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "BugBash1"; + const vaultName = "BugBashVaultForCCYv11"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.jobs.list(resourceGroupName, vaultName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getJobs(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/operationResultGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/operationResultGetSample.ts new file mode 100644 index 000000000000..06b4fc04ba00 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/operationResultGetSample.ts @@ -0,0 +1,40 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the operation result for a resource + * + * @summary Gets the operation result for a resource + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationResult.json + */ +async function getOperationResult() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const operationId = + "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="; + const location = "WestUS"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.operationResult.get(operationId, location); + console.log(result); +} + +async function main() { + getOperationResult(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/operationStatusBackupVaultContextGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/operationStatusBackupVaultContextGetSample.ts new file mode 100644 index 000000000000..be5dda7000e0 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/operationStatusBackupVaultContextGetSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the operation status for an operation over a BackupVault's context. + * + * @summary Gets the operation status for an operation over a BackupVault's context. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatusVaultContext.json + */ +async function getOperationStatus() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const vaultName = "swaggerExample"; + const operationId = + "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.operationStatusBackupVaultContext.get( + resourceGroupName, + vaultName, + operationId + ); + console.log(result); +} + +async function main() { + getOperationStatus(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/operationStatusGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/operationStatusGetSample.ts new file mode 100644 index 000000000000..be020b0d6aff --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/operationStatusGetSample.ts @@ -0,0 +1,40 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the operation status for a resource. + * + * @summary Gets the operation status for a resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatus.json + */ +async function getOperationStatus() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const location = "WestUS"; + const operationId = + "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.operationStatus.get(location, operationId); + console.log(result); +} + +async function main() { + getOperationStatus(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/operationStatusResourceGroupContextGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/operationStatusResourceGroupContextGetSample.ts new file mode 100644 index 000000000000..e23d25be7db7 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/operationStatusResourceGroupContextGetSample.ts @@ -0,0 +1,44 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the operation status for an operation over a ResourceGroup's context. + * + * @summary Gets the operation status for an operation over a ResourceGroup's context. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/GetOperationStatusRGContext.json + */ +async function getOperationStatus() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const operationId = + "MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA=="; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.operationStatusResourceGroupContext.get( + resourceGroupName, + operationId + ); + console.log(result); +} + +async function main() { + getOperationStatus(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/recoveryPointsGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/recoveryPointsGetSample.ts new file mode 100644 index 000000000000..abe512d15dd9 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/recoveryPointsGetSample.ts @@ -0,0 +1,47 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Recovery Point using recoveryPointId for a Datasource. + * + * @summary Gets a Recovery Point using recoveryPointId for a Datasource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/GetRecoveryPoint.json + */ +async function getRecoveryPoint() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const recoveryPointId = "7fb2cddd-c5b3-44f6-a0d9-db3c4f9d5f25"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.recoveryPoints.get( + resourceGroupName, + vaultName, + backupInstanceName, + recoveryPointId + ); + console.log(result); +} + +async function main() { + getRecoveryPoint(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/recoveryPointsListSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/recoveryPointsListSample.ts new file mode 100644 index 000000000000..053684c5d0da --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/recoveryPointsListSample.ts @@ -0,0 +1,48 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns a list of Recovery Points for a DataSource in a vault. + * + * @summary Returns a list of Recovery Points for a DataSource in a vault. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/ListRecoveryPoints.json + */ +async function listRecoveryPointsInAVault() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "000pikumar"; + const vaultName = "PratikPrivatePreviewVault1"; + const backupInstanceName = "testInstance1"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.recoveryPoints.list( + resourceGroupName, + vaultName, + backupInstanceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listRecoveryPointsInAVault(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsDeleteSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsDeleteSample.ts new file mode 100644 index 000000000000..c5595edfa0cc --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsDeleteSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a ResourceGuard resource from the resource group. + * + * @summary Deletes a ResourceGuard resource from the resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/DeleteResourceGuard.json + */ +async function deleteResourceGuard() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.delete( + resourceGroupName, + resourceGuardsName + ); + console.log(result); +} + +async function main() { + deleteResourceGuard(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetBackupSecurityPinRequestsObjectsSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetBackupSecurityPinRequestsObjectsSample.ts new file mode 100644 index 000000000000..87055d4c9fa0 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetBackupSecurityPinRequestsObjectsSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listBackupSecurityPINRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultBackupSecurityPinRequestsObjectSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultBackupSecurityPinRequestsObjectSample.ts new file mode 100644 index 000000000000..ce45d7b79de5 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultBackupSecurityPinRequestsObjectSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultBackupSecurityPINRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultDeleteProtectedItemRequestsObjectSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultDeleteProtectedItemRequestsObjectSample.ts new file mode 100644 index 000000000000..1f4b79838097 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultDeleteProtectedItemRequestsObjectSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultDeleteProtectedItemRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectSample.ts new file mode 100644 index 000000000000..e72c972c62b9 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultDeleteResourceGuardProxyRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultDisableSoftDeleteRequestsObjectSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultDisableSoftDeleteRequestsObjectSample.ts new file mode 100644 index 000000000000..6b41c6b3e441 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultDisableSoftDeleteRequestsObjectSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultDisableSoftDeleteRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultUpdateProtectedItemRequestsObjectSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultUpdateProtectedItemRequestsObjectSample.ts new file mode 100644 index 000000000000..b410cb392c35 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultUpdateProtectedItemRequestsObjectSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultUpdateProtectedItemRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectSample.ts new file mode 100644 index 000000000000..ee4cbc60b6f9 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectSample.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json + */ +async function getDefaultOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const requestName = "default"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.getDefaultUpdateProtectionPolicyRequestsObject( + resourceGroupName, + resourceGuardsName, + requestName + ); + console.log(result); +} + +async function main() { + getDefaultOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDeleteProtectedItemRequestsObjectsSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDeleteProtectedItemRequestsObjectsSample.ts new file mode 100644 index 000000000000..32c66b58b72b --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDeleteProtectedItemRequestsObjectsSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listDeleteProtectedItemRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDeleteResourceGuardProxyRequestsObjectsSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDeleteResourceGuardProxyRequestsObjectsSample.ts new file mode 100644 index 000000000000..85ac3a3e7ee7 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDeleteResourceGuardProxyRequestsObjectsSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listDeleteResourceGuardProxyRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDisableSoftDeleteRequestsObjectsSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDisableSoftDeleteRequestsObjectsSample.ts new file mode 100644 index 000000000000..401ac850a825 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetDisableSoftDeleteRequestsObjectsSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listDisableSoftDeleteRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetResourcesInResourceGroupSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetResourcesInResourceGroupSample.ts new file mode 100644 index 000000000000..57a1880a8883 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetResourcesInResourceGroupSample.ts @@ -0,0 +1,44 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns ResourceGuards collection belonging to a ResourceGroup. + * + * @summary Returns ResourceGuards collection belonging to a ResourceGroup. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json + */ +async function getResourceGuardsInResourceGroup() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listResourcesInResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getResourceGuardsInResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetResourcesInSubscriptionSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetResourcesInSubscriptionSample.ts new file mode 100644 index 000000000000..7697e416fea7 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetResourcesInSubscriptionSample.ts @@ -0,0 +1,40 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns ResourceGuards collection belonging to a subscription. + * + * @summary Returns ResourceGuards collection belonging to a subscription. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json + */ +async function getResourceGuardsInSubscription() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listResourcesInSubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + getResourceGuardsInSubscription(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetSample.ts new file mode 100644 index 000000000000..e71ec08a28aa --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns a ResourceGuard belonging to a resource group. + * + * @summary Returns a ResourceGuard belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/GetResourceGuard.json + */ +async function getResourceGuard() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.get( + resourceGroupName, + resourceGuardsName + ); + console.log(result); +} + +async function main() { + getResourceGuard(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetUpdateProtectedItemRequestsObjectsSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetUpdateProtectedItemRequestsObjectsSample.ts new file mode 100644 index 000000000000..6428bba128e4 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetUpdateProtectedItemRequestsObjectsSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listUpdateProtectedItemRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetUpdateProtectionPolicyRequestsObjectsSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetUpdateProtectionPolicyRequestsObjectsSample.ts new file mode 100644 index 000000000000..b28f1b017ae2 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsGetUpdateProtectionPolicyRequestsObjectsSample.ts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { DataProtectionClient } from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * + * @summary Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json + */ +async function listOperationsRequestObject() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.resourceGuards.listUpdateProtectionPolicyRequestsObjects( + resourceGroupName, + resourceGuardsName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listOperationsRequestObject(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsPatchSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsPatchSample.ts new file mode 100644 index 000000000000..63874fd41831 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsPatchSample.ts @@ -0,0 +1,48 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + PatchResourceRequestInput, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. + * + * @summary Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/PatchResourceGuard.json + */ +async function patchResourceGuard() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const parameters: PatchResourceRequestInput = { tags: { newKey: "newVal" } }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.patch( + resourceGroupName, + resourceGuardsName, + parameters + ); + console.log(result); +} + +async function main() { + patchResourceGuard(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsPutSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsPutSample.ts new file mode 100644 index 000000000000..621ed587bf3e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/resourceGuardsPutSample.ts @@ -0,0 +1,51 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ResourceGuardResource, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a ResourceGuard resource belonging to a resource group. + * + * @summary Creates or updates a ResourceGuard resource belonging to a resource group. + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/ResourceGuardCRUD/PutResourceGuard.json + */ +async function createResourceGuard() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "0b352192-dcac-4cc7-992e-a96190ccc68c"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "SampleResourceGroup"; + const resourceGuardsName = "swaggerExample"; + const parameters: ResourceGuardResource = { + location: "WestUS", + tags: { key1: "val1" } + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.resourceGuards.put( + resourceGroupName, + resourceGuardsName, + parameters + ); + console.log(result); +} + +async function main() { + createResourceGuard(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/restorableTimeRangesFindSample.ts b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/restorableTimeRangesFindSample.ts new file mode 100644 index 000000000000..d24d1a021a41 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/src/restorableTimeRangesFindSample.ts @@ -0,0 +1,54 @@ +/* + * 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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + AzureBackupFindRestorableTimeRangesRequest, + DataProtectionClient +} from "@azure/arm-dataprotection"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/preview/2022-11-01-preview/examples/BackupInstanceOperations/FindRestorableTimeRanges.json + */ +async function findRestorableTimeRanges() { + const subscriptionId = + process.env["DATAPROTECTION_SUBSCRIPTION_ID"] || + "04cf684a-d41f-4550-9f70-7708a3a2283b"; + const resourceGroupName = + process.env["DATAPROTECTION_RESOURCE_GROUP"] || "Blob-Backup"; + const vaultName = "ZBlobBackupVaultBVTD3"; + const backupInstanceName = "zblobbackuptestsa58"; + const parameters: AzureBackupFindRestorableTimeRangesRequest = { + endTime: "2021-02-24T00:35:17.6829685Z", + sourceDataStoreType: "OperationalStore", + startTime: "2020-10-17T23:28:17.6829685Z" + }; + const credential = new DefaultAzureCredential(); + const client = new DataProtectionClient(credential, subscriptionId); + const result = await client.restorableTimeRanges.find( + resourceGroupName, + vaultName, + backupInstanceName, + parameters + ); + console.log(result); +} + +async function main() { + findRestorableTimeRanges(); +} + +main().catch(console.error); diff --git a/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/tsconfig.json b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/tsconfig.json new file mode 100644 index 000000000000..e26ce2a6d8f7 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/samples/v1-beta/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/dataprotection/arm-dataprotection/src/dataProtectionClient.ts b/sdk/dataprotection/arm-dataprotection/src/dataProtectionClient.ts new file mode 100644 index 000000000000..4cb3efaf67f7 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/dataProtectionClient.ts @@ -0,0 +1,224 @@ +/* + * 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 * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; +import * as coreAuth from "@azure/core-auth"; +import { + BackupVaultsImpl, + OperationResultImpl, + OperationStatusImpl, + OperationStatusBackupVaultContextImpl, + OperationStatusResourceGroupContextImpl, + BackupVaultOperationResultsImpl, + DataProtectionImpl, + DataProtectionOperationsImpl, + BackupPoliciesImpl, + BackupInstancesImpl, + BackupInstancesExtensionRoutingImpl, + RecoveryPointsImpl, + JobsImpl, + RestorableTimeRangesImpl, + ExportJobsImpl, + ExportJobsOperationResultImpl, + DeletedBackupInstancesImpl, + ResourceGuardsImpl, + DppResourceGuardProxyImpl +} from "./operations"; +import { + BackupVaults, + OperationResult, + OperationStatus, + OperationStatusBackupVaultContext, + OperationStatusResourceGroupContext, + BackupVaultOperationResults, + DataProtection, + DataProtectionOperations, + BackupPolicies, + BackupInstances, + BackupInstancesExtensionRouting, + RecoveryPoints, + Jobs, + RestorableTimeRanges, + ExportJobs, + ExportJobsOperationResult, + DeletedBackupInstances, + ResourceGuards, + DppResourceGuardProxy +} from "./operationsInterfaces"; +import { DataProtectionClientOptionalParams } from "./models"; + +export class DataProtectionClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the DataProtectionClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The subscription Id. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: DataProtectionClientOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: DataProtectionClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-dataprotection/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + endpoint: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" + }; + super(optionsWithDefaults); + + let bearerTokenAuthenticationPolicyFound: boolean = false; + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + } + if ( + !options || + !options.pipeline || + options.pipeline.getOrderedPolicies().length == 0 || + !bearerTokenAuthenticationPolicyFound + ) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + credential: credentials, + scopes: + optionsWithDefaults.credentialScopes ?? + `${optionsWithDefaults.endpoint}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2022-11-01-preview"; + this.backupVaults = new BackupVaultsImpl(this); + this.operationResult = new OperationResultImpl(this); + this.operationStatus = new OperationStatusImpl(this); + this.operationStatusBackupVaultContext = new OperationStatusBackupVaultContextImpl( + this + ); + this.operationStatusResourceGroupContext = new OperationStatusResourceGroupContextImpl( + this + ); + this.backupVaultOperationResults = new BackupVaultOperationResultsImpl( + this + ); + this.dataProtection = new DataProtectionImpl(this); + this.dataProtectionOperations = new DataProtectionOperationsImpl(this); + this.backupPolicies = new BackupPoliciesImpl(this); + this.backupInstances = new BackupInstancesImpl(this); + this.backupInstancesExtensionRouting = new BackupInstancesExtensionRoutingImpl( + this + ); + this.recoveryPoints = new RecoveryPointsImpl(this); + this.jobs = new JobsImpl(this); + this.restorableTimeRanges = new RestorableTimeRangesImpl(this); + this.exportJobs = new ExportJobsImpl(this); + this.exportJobsOperationResult = new ExportJobsOperationResultImpl(this); + this.deletedBackupInstances = new DeletedBackupInstancesImpl(this); + this.resourceGuards = new ResourceGuardsImpl(this); + this.dppResourceGuardProxy = new DppResourceGuardProxyImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + backupVaults: BackupVaults; + operationResult: OperationResult; + operationStatus: OperationStatus; + operationStatusBackupVaultContext: OperationStatusBackupVaultContext; + operationStatusResourceGroupContext: OperationStatusResourceGroupContext; + backupVaultOperationResults: BackupVaultOperationResults; + dataProtection: DataProtection; + dataProtectionOperations: DataProtectionOperations; + backupPolicies: BackupPolicies; + backupInstances: BackupInstances; + backupInstancesExtensionRouting: BackupInstancesExtensionRouting; + recoveryPoints: RecoveryPoints; + jobs: Jobs; + restorableTimeRanges: RestorableTimeRanges; + exportJobs: ExportJobs; + exportJobsOperationResult: ExportJobsOperationResult; + deletedBackupInstances: DeletedBackupInstances; + resourceGuards: ResourceGuards; + dppResourceGuardProxy: DppResourceGuardProxy; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/index.ts b/sdk/dataprotection/arm-dataprotection/src/index.ts new file mode 100644 index 000000000000..78f31debd8fe --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/index.ts @@ -0,0 +1,13 @@ +/* + * 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. + */ + +/// +export { getContinuationToken } from "./pagingHelper"; +export * from "./models"; +export { DataProtectionClient } from "./dataProtectionClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/dataprotection/arm-dataprotection/src/lroImpl.ts b/sdk/dataprotection/arm-dataprotection/src/lroImpl.ts new file mode 100644 index 000000000000..518d5f053b4e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/lroImpl.ts @@ -0,0 +1,34 @@ +/* + * 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 { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export class LroImpl implements LongRunningOperation { + constructor( + private sendOperationFn: (args: any, spec: any) => Promise>, + private args: Record, + private spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest(): Promise> { + return this.sendOperationFn(this.args, this.spec); + } + public async sendPollRequest(path: string): Promise> { + const { requestBody, ...restSpec } = this.spec; + return this.sendOperationFn(this.args, { + ...restSpec, + path, + httpMethod: "GET" + }); + } +} diff --git a/sdk/dataprotection/arm-dataprotection/src/models/index.ts b/sdk/dataprotection/arm-dataprotection/src/models/index.ts new file mode 100644 index 000000000000..7833b1cc268f --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/models/index.ts @@ -0,0 +1,3161 @@ +/* + * 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 * as coreClient from "@azure/core-client"; + +export type OperationExtendedInfoUnion = + | OperationExtendedInfo + | OperationJobExtendedInfo; +export type FeatureValidationRequestBaseUnion = + | FeatureValidationRequestBase + | FeatureValidationRequest; +export type FeatureValidationResponseBaseUnion = + | FeatureValidationResponseBase + | FeatureValidationResponse; +export type BaseBackupPolicyUnion = BaseBackupPolicy | BackupPolicy; +export type DataStoreParametersUnion = + | DataStoreParameters + | AzureOperationalStoreParameters; +export type BackupDatasourceParametersUnion = + | BackupDatasourceParameters + | KubernetesClusterBackupDatasourceParameters + | BlobBackupDatasourceParameters; +export type AuthCredentialsUnion = + | AuthCredentials + | SecretStoreBasedAuthCredentials; +export type AzureBackupRecoveryPointUnion = + | AzureBackupRecoveryPoint + | AzureBackupDiscreteRecoveryPoint; +export type AzureBackupRestoreRequestUnion = + | AzureBackupRestoreRequest + | AzureBackupRecoveryPointBasedRestoreRequestUnion + | AzureBackupRecoveryTimeBasedRestoreRequest; +export type RestoreTargetInfoBaseUnion = + | RestoreTargetInfoBase + | ItemLevelRestoreTargetInfo + | RestoreFilesTargetInfo + | RestoreTargetInfo; +export type DeleteOptionUnion = DeleteOption | AbsoluteDeleteOption; +export type TriggerContextUnion = + | TriggerContext + | AdhocBasedTriggerContext + | ScheduleBasedTriggerContext; +export type BackupParametersUnion = BackupParameters | AzureBackupParams; +export type BasePolicyRuleUnion = + | BasePolicyRule + | AzureBackupRule + | AzureRetentionRule; +export type CopyOptionUnion = + | CopyOption + | CopyOnExpiryOption + | CustomCopyOption + | ImmediateCopyOption; +export type BackupCriteriaUnion = BackupCriteria | ScheduleBasedBackupCriteria; +export type ItemLevelRestoreCriteriaUnion = + | ItemLevelRestoreCriteria + | ItemPathBasedRestoreCriteria + | RangeBasedItemLevelRestoreCriteria + | KubernetesStorageClassRestoreCriteria + | KubernetesPVRestoreCriteria + | KubernetesClusterRestoreCriteria; +export type AzureBackupRecoveryPointBasedRestoreRequestUnion = + | AzureBackupRecoveryPointBasedRestoreRequest + | AzureBackupRestoreWithRehydrationRequest; + +/** Backup Vault */ +export interface BackupVault { + /** Monitoring Settings */ + monitoringSettings?: MonitoringSettings; + /** + * Provisioning state of the BackupVault resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** + * Resource move state for backup vault + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resourceMoveState?: ResourceMoveState; + /** + * Resource move details for backup vault + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resourceMoveDetails?: ResourceMoveDetails; + /** Security Settings */ + securitySettings?: SecuritySettings; + /** Storage Settings */ + storageSettings: StorageSetting[]; + /** + * Is vault protected by resource guard + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly isVaultProtectedByResourceGuard?: boolean; +} + +/** Monitoring Settings */ +export interface MonitoringSettings { + /** Settings for Azure Monitor based alerts */ + azureMonitorAlertSettings?: AzureMonitorAlertSettings; +} + +/** Settings for Azure Monitor based alerts */ +export interface AzureMonitorAlertSettings { + alertsForAllJobFailures?: AlertsState; +} + +/** ResourceMoveDetails will be returned in response to GetResource call from ARM */ +export interface ResourceMoveDetails { + /** CorrelationId of latest ResourceMove operation attempted */ + operationId?: string; + /** Start time in UTC of latest ResourceMove operation attempted. ISO 8601 format. */ + startTimeUtc?: string; + /** Completion time in UTC of latest ResourceMove operation attempted. ISO 8601 format. */ + completionTimeUtc?: string; + /** ARM resource path of source resource */ + sourceResourcePath?: string; + /** ARM resource path of target resource used in latest ResourceMove operation */ + targetResourcePath?: string; +} + +/** Class containing security settings of vault */ +export interface SecuritySettings { + /** Soft delete related settings */ + softDeleteSettings?: SoftDeleteSettings; + /** Immutability Settings at vault level */ + immutabilitySettings?: ImmutabilitySettings; +} + +/** Soft delete related settings */ +export interface SoftDeleteSettings { + /** State of soft delete */ + state?: SoftDeleteState; + /** Soft delete retention duration */ + retentionDurationInDays?: number; +} + +/** Immutability Settings at vault level */ +export interface ImmutabilitySettings { + /** Immutability state */ + state?: ImmutabilityState; +} + +/** Storage setting */ +export interface StorageSetting { + /** Gets or sets the type of the datastore. */ + datastoreType?: StorageSettingStoreTypes; + /** Gets or sets the type. */ + type?: StorageSettingTypes; +} + +export interface DppTrackedResource { + /** Optional ETag. */ + eTag?: string; + /** + * Resource Id represents the complete path to the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** Input Managed Identity Details */ + identity?: DppIdentityDetails; + /** Resource location. */ + location?: string; + /** + * Resource name associated with the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** + * Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Metadata pertaining to creation and last modification of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Identity details */ +export interface DppIdentityDetails { + /** + * The object ID of the service principal object for the managed identity that is used to grant role-based access to an Azure resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * A Globally Unique Identifier (GUID) that represents the Azure AD tenant where the resource is now a member. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; + /** The identityType which can be either SystemAssigned or None */ + type?: string; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The type of identity that last modified the resource. */ + lastModifiedAt?: Date; +} + +/** ListResource */ +export interface DppResourceList { + /** The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. */ + nextLink?: string; +} + +/** An error response from Azure Backup. */ +export interface CloudError { + /** The resource management error response. */ + error?: ErrorModel; +} + +/** The resource management error response. */ +export interface ErrorModel { + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorModel[]; + /** + * 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 resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; +} + +/** Operation Extended Info */ +export interface OperationExtendedInfo { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "OperationJobExtendedInfo"; +} + +/** Operation Resource */ +export interface OperationResource { + /** End time of the operation */ + endTime?: Date; + /** + * Required if status == failed or status == canceled. This is the OData v4 error format, used by the RPC and will go into the v2.2 Azure REST API guidelines. + * The full set of optional properties (e.g. inner errors / details) can be found in the "Error Response" section. + */ + error?: ErrorModel; + /** It should match what is used to GET the operation result */ + id?: string; + /** It must match the last segment of the "id" field, and will typically be a GUID / system generated value */ + name?: string; + /** End time of the operation */ + properties?: OperationExtendedInfoUnion; + /** Start time of the operation */ + startTime?: Date; + status?: string; +} + +/** Patch Request content for Microsoft.DataProtection resources */ +export interface PatchResourceRequestInput { + /** Input Managed Identity Details */ + identity?: DppIdentityDetails; + /** Resource properties. */ + properties?: PatchBackupVaultInput; + /** Resource tags. */ + tags?: { [propertyName: string]: string }; +} + +/** Backup Vault Contract for Patch Backup Vault API. */ +export interface PatchBackupVaultInput { + /** Monitoring Settings */ + monitoringSettings?: MonitoringSettings; + /** Security Settings */ + securitySettings?: SecuritySettings; +} + +/** CheckNameAvailability Request */ +export interface CheckNameAvailabilityRequest { + /** Resource name for which availability needs to be checked */ + name?: string; + /** Describes the Resource type: Microsoft.DataProtection/BackupVaults */ + type?: string; +} + +/** CheckNameAvailability Result */ +export interface CheckNameAvailabilityResult { + /** Gets or sets the message. */ + message?: string; + /** Gets or sets a value indicating whether [name available]. */ + nameAvailable?: boolean; + /** Gets or sets the reason. */ + reason?: string; +} + +/** Base class for Backup Feature support */ +export interface FeatureValidationRequestBase { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "FeatureValidationRequest"; +} + +/** Base class for Backup Feature support */ +export interface FeatureValidationResponseBase { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "FeatureValidationResponse"; +} + +/** Operations List response which contains list of available APIs. */ +export interface ClientDiscoveryResponse { + /** Link to the next chunk of Response. */ + nextLink?: string; + /** List of available operations. */ + value?: ClientDiscoveryValueForSingleApi[]; +} + +/** Available operation details. */ +export interface ClientDiscoveryValueForSingleApi { + /** Contains the localized display information for this particular operation */ + display?: ClientDiscoveryDisplay; + /** Name of the Operation. */ + name?: string; + /** Indicates whether the operation is a data action */ + isDataAction?: boolean; + /** The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX */ + origin?: string; + /** Properties for the given operation. */ + properties?: ClientDiscoveryForProperties; +} + +/** Localized display information of an operation. */ +export interface ClientDiscoveryDisplay { + /** Description of the operation having details of what operation is about. */ + description?: string; + /** Operations Name itself. */ + operation?: string; + /** Name of the provider for display purposes */ + provider?: string; + /** ResourceType for which this Operation can be performed. */ + resource?: string; +} + +/** Class to represent shoebox properties in json client discovery. */ +export interface ClientDiscoveryForProperties { + /** Operation properties. */ + serviceSpecification?: ClientDiscoveryForServiceSpecification; +} + +/** Class to represent shoebox service specification in json client discovery. */ +export interface ClientDiscoveryForServiceSpecification { + /** List of log specifications of this operation. */ + logSpecifications?: ClientDiscoveryForLogSpecification[]; +} + +/** Class to represent shoebox log specification in json client discovery. */ +export interface ClientDiscoveryForLogSpecification { + /** blob duration of shoebox log specification */ + blobDuration?: string; + /** Localized display name */ + displayName?: string; + /** Name for shoebox log specification. */ + name?: string; +} + +/** BackupPolicy base */ +export interface BaseBackupPolicy { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "BackupPolicy"; + /** Type of datasource for the backup management */ + datasourceTypes: string[]; +} + +/** Resource class */ +export interface DppResource { + /** + * Resource Id represents the complete path to the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * Resource name associated with the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Metadata pertaining to creation and last modification of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Backup Instance */ +export interface BackupInstance { + /** Gets or sets the Backup Instance friendly name. */ + friendlyName?: string; + /** Gets or sets the data source information. */ + dataSourceInfo: Datasource; + /** Gets or sets the data source set information. */ + dataSourceSetInfo?: DatasourceSet; + /** Gets or sets the policy information. */ + policyInfo: PolicyInfo; + /** + * Specifies the protection status of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly protectionStatus?: ProtectionStatusDetails; + /** + * Specifies the current protection state of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly currentProtectionState?: CurrentProtectionState; + /** + * Specifies the protection error of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly protectionErrorDetails?: UserFacingError; + /** + * Specifies the provisioning state of the resource i.e. provisioning/updating/Succeeded/Failed + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: string; + /** Credentials to use to authenticate with data source provider. */ + datasourceAuthCredentials?: AuthCredentialsUnion; + /** Specifies the type of validation. In case of DeepValidation, all validations from /validateForBackup API will run again. */ + validationType?: ValidationType; + objectType: string; +} + +/** Datasource to be backed up */ +export interface Datasource { + /** DatasourceType of the resource. */ + datasourceType?: string; + /** Type of Datasource object, used to initialize the right inherited type */ + objectType?: string; + /** Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure resources, this will be the ID created by backup service via Fabric/Vault. */ + resourceID: string; + /** Location of datasource. */ + resourceLocation?: string; + /** Unique identifier of the resource in the context of parent. */ + resourceName?: string; + /** Resource Type of Datasource. */ + resourceType?: string; + /** Uri of the resource. */ + resourceUri?: string; +} + +/** DatasourceSet details of datasource to be backed up */ +export interface DatasourceSet { + /** DatasourceType of the resource. */ + datasourceType?: string; + /** Type of Datasource object, used to initialize the right inherited type */ + objectType?: string; + /** Full ARM ID of the resource. For azure resources, this is ARM ID. For non azure resources, this will be the ID created by backup service via Fabric/Vault. */ + resourceID: string; + /** Location of datasource. */ + resourceLocation?: string; + /** Unique identifier of the resource in the context of parent. */ + resourceName?: string; + /** Resource Type of Datasource. */ + resourceType?: string; + /** Uri of the resource. */ + resourceUri?: string; +} + +/** Policy Info in backupInstance */ +export interface PolicyInfo { + policyId: string; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly policyVersion?: string; + /** Policy parameters for the backup instance */ + policyParameters?: PolicyParameters; +} + +/** Parameters in Policy */ +export interface PolicyParameters { + /** Gets or sets the DataStore Parameters */ + dataStoreParametersList?: DataStoreParametersUnion[]; + /** Gets or sets the Backup Data Source Parameters */ + backupDatasourceParametersList?: BackupDatasourceParametersUnion[]; +} + +/** Parameters for DataStore */ +export interface DataStoreParameters { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "AzureOperationalStoreParameters"; + /** type of datastore; Operational/Vault/Archive */ + dataStoreType: DataStoreTypes; +} + +/** Parameters for Backup Datasource */ +export interface BackupDatasourceParameters { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: + | "KubernetesClusterBackupDatasourceParameters" + | "BlobBackupDatasourceParameters"; +} + +/** Protection status details */ +export interface ProtectionStatusDetails { + /** Specifies the protection status error of the resource */ + errorDetails?: UserFacingError; + /** Specifies the protection status of the resource */ + status?: Status; +} + +/** Error object used by layers that have access to localized content, and propagate that to user */ +export interface UserFacingError { + /** Unique code for this error */ + code?: string; + /** Additional related Errors */ + details?: UserFacingError[]; + /** Inner Error */ + innerError?: InnerError; + /** Whether the operation will be retryable or not */ + isRetryable?: boolean; + /** Whether the operation is due to a user error or service error */ + isUserError?: boolean; + /** Any key value pairs that can be injected inside error object */ + properties?: { [propertyName: string]: string }; + message?: string; + /** RecommendedAction � localized. */ + recommendedAction?: string[]; + /** Target of the error. */ + target?: string; +} + +/** Inner Error */ +export interface InnerError { + /** Any Key value pairs that can be provided to the client for additional verbose information. */ + additionalInfo?: { [propertyName: string]: string }; + /** Unique code for this error */ + code?: string; + /** Child Inner Error, to allow Nesting. */ + embeddedInnerError?: InnerError; +} + +/** Base class for different types of authentication credentials. */ +export interface AuthCredentials { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "SecretStoreBasedAuthCredentials"; +} + +export interface DppProxyResource { + /** + * Proxy Resource Id represents the complete path to the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * Proxy Resource name associated with the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Proxy Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** Proxy Resource tags. */ + tags?: { [propertyName: string]: string }; + /** + * Metadata pertaining to creation and last modification of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Trigger backup request */ +export interface TriggerBackupRequest { + /** Name for the Rule of the Policy which needs to be applied for this backup */ + backupRuleOptions: AdHocBackupRuleOptions; +} + +/** Adhoc backup rules */ +export interface AdHocBackupRuleOptions { + ruleName: string; + /** Adhoc backup trigger option */ + triggerOption: AdhocBackupTriggerOption; +} + +/** Adhoc backup trigger option */ +export interface AdhocBackupTriggerOption { + retentionTagOverride?: string; +} + +/** Validate for backup request */ +export interface ValidateForBackupRequest { + /** Backup Instance */ + backupInstance: BackupInstance; +} + +/** Azure backup recoveryPoint */ +export interface AzureBackupRecoveryPoint { + /** Polymorphic discriminator, which specifies the different types this object can be */ + 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; +} + +/** Azure backup restore request */ +export interface AzureBackupRestoreRequest { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: + | "AzureBackupRecoveryPointBasedRestoreRequest" + | "AzureBackupRestoreWithRehydrationRequest" + | "AzureBackupRecoveryTimeBasedRestoreRequest"; + /** Gets or sets the restore target information. */ + restoreTargetInfo: RestoreTargetInfoBaseUnion; + /** Gets or sets the type of the source data store. */ + sourceDataStoreType: SourceDataStoreType; + /** Fully qualified Azure Resource Manager ID of the datasource which is being recovered. */ + sourceResourceId?: string; +} + +/** Base class common to RestoreTargetInfo and RestoreFilesTargetInfo */ +export interface RestoreTargetInfoBase { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: + | "ItemLevelRestoreTargetInfo" + | "RestoreFilesTargetInfo" + | "RestoreTargetInfo"; + /** Recovery Option */ + recoveryOption: RecoveryOption; + /** Target Restore region */ + 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; +} + +/** Validate restore request object */ +export interface ValidateRestoreRequestObject { + /** Gets or sets the restore request object. */ + restoreRequestObject: AzureBackupRestoreRequestUnion; +} + +/** AzureBackup Job Class */ +export interface AzureBackupJob { + /** Job Activity Id */ + activityID: string; + /** Name of the Backup Instance */ + backupInstanceFriendlyName: string; + /** + * ARM ID of the Backup Instance + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly backupInstanceId?: string; + /** ARM ID of the DataSource */ + dataSourceId: string; + /** Location of the DataSource */ + dataSourceLocation: string; + /** User Friendly Name of the DataSource */ + dataSourceName: string; + /** Data Source Set Name of the DataSource */ + dataSourceSetName?: string; + /** Type of DataSource */ + dataSourceType: string; + /** Total run time of the job. ISO 8601 format. */ + duration?: string; + /** + * EndTime of the job(in UTC) + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly endTime?: Date; + /** + * A List, detailing the errors related to the job + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly errorDetails?: UserFacingError[]; + /** + * Extended Information about the job + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly extendedInfo?: JobExtendedInfo; + /** Indicated that whether the job is adhoc(true) or scheduled(false) */ + isUserTriggered: boolean; + /** It indicates the type of Job i.e. Backup:full/log/diff ;Restore:ALR/OLR; Tiering:Backup/Archive ; Management:ConfigureProtection/UnConfigure */ + operation: string; + /** It indicates the type of Job i.e. Backup/Restore/Tiering/Management */ + operationCategory: string; + /** + * ARM ID of the policy + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly policyId?: string; + /** + * Name of the policy + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly policyName?: string; + /** Indicated whether progress is enabled for the job */ + progressEnabled: boolean; + /** + * Url which contains job's progress + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly progressUrl?: string; + /** + * It indicates the sub type of operation i.e. in case of Restore it can be ALR/OLR + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly restoreType?: string; + /** Resource Group Name of the Datasource */ + sourceResourceGroup: string; + /** SubscriptionId corresponding to the DataSource */ + sourceSubscriptionID: string; + /** StartTime of the job(in UTC) */ + startTime: Date; + /** Status of the job like InProgress/Success/Failed/Cancelled/SuccessWithWarning */ + status: string; + /** Subscription Id of the corresponding backup vault */ + subscriptionId: string; + /** List of supported actions */ + supportedActions: string[]; + /** Name of the vault */ + vaultName: string; + etag?: string; + sourceDataStoreName?: string; + destinationDataStoreName?: string; +} + +/** Extended Information about the job */ +export interface JobExtendedInfo { + /** Job's Additional Details */ + additionalDetails?: { [propertyName: string]: string }; + /** + * State of the Backup Instance + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly backupInstanceState?: string; + /** + * Number of bytes transferred + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly dataTransferredInBytes?: number; + /** + * Destination where restore is done + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly recoveryDestination?: string; + /** + * Details of the Source Recovery Point + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sourceRecoverPoint?: RestoreJobRecoveryPointDetails; + /** + * List of Sub Tasks of the job + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly subTasks?: JobSubTask[]; + /** + * Details of the Target Recovery Point + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly targetRecoverPoint?: RestoreJobRecoveryPointDetails; +} + +export interface RestoreJobRecoveryPointDetails { + recoveryPointID?: string; + recoveryPointTime?: Date; +} + +/** Details of Job's Sub Task */ +export interface JobSubTask { + /** Additional details of Sub Tasks */ + additionalDetails?: { [propertyName: string]: string }; + /** Task Id of the Sub Task */ + taskId: number; + /** Name of the Sub Task */ + taskName: string; + /** + * Progress of the Sub Task + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly taskProgress?: string; + /** Status of the Sub Task */ + taskStatus: string; +} + +/** List Restore Ranges Request */ +export interface AzureBackupFindRestorableTimeRangesRequest { + /** Gets or sets the type of the source data store. */ + sourceDataStoreType: RestoreSourceDataStoreType; + /** Start time for the List Restore Ranges request. ISO 8601 format. */ + startTime?: string; + /** End time for the List Restore Ranges request. ISO 8601 format. */ + endTime?: string; +} + +/** List Restore Ranges Response */ +export interface AzureBackupFindRestorableTimeRangesResponse { + /** Returns the Restore Ranges available on the Backup Instance. */ + restorableTimeRanges?: RestorableTimeRange[]; + objectType?: string; +} + +export interface RestorableTimeRange { + /** Start time for the available restore range */ + startTime: string; + /** End time for the available restore range */ + endTime: string; + objectType?: string; +} + +/** The result for export jobs containing blob details. */ +export interface ExportJobsResult { + /** + * URL of the blob into which the serialized string of list of jobs is exported. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly blobUrl?: string; + /** + * SAS key to access the blob. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly blobSasKey?: string; + /** + * URL of the blob into which the ExcelFile is uploaded. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly excelFileBlobUrl?: string; + /** + * SAS key to access the ExcelFile blob. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly excelFileBlobSasKey?: string; +} + +/** Deletion Info */ +export interface DeletionInfo { + /** + * Specifies time of deletion + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly deletionTime?: string; + /** + * Specifies billing end date + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly billingEndDate?: string; + /** + * Specifies purge time + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly scheduledPurgeTime?: string; + /** + * Delete activity ID for troubleshooting purpose + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly deleteActivityID?: string; +} + +export interface ResourceGuard { + /** + * Provisioning state of the BackupVault resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ResourceGuardProvisioningState; + /** + * This flag indicates whether auto approval is allowed or not. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly allowAutoApprovals?: boolean; + /** + * {readonly} List of operation details those are protected by the ResourceGuard resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resourceGuardOperations?: ResourceGuardOperation[]; + /** List of critical operations which are not protected by this resourceGuard */ + vaultCriticalOperationExclusionList?: string[]; + /** + * Description about the pre-req steps to perform all the critical operations. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; +} + +/** This class contains all the details about a critical operation. */ +export interface ResourceGuardOperation { + /** + * Name of the critical operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly vaultCriticalOperation?: string; + /** + * Type of resource request. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly requestResourceType?: string; +} + +export interface DppTrackedResourceList { + /** The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. */ + nextLink?: string; +} + +/** Base for all lists of V2 resources. */ +export interface DppBaseResourceList { + /** List of Dpp resources. */ + value?: DppBaseResource[]; + /** The uri to fetch the next page of resources. Call ListNext() fetches next page of resources. */ + nextLink?: string; +} + +/** Base resource under Microsoft.DataProtection provider namespace */ +export interface DppBaseResource { + /** + * Resource Id represents the complete path to the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * Resource name associated with the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; +} + +export interface ResourceGuardProxyBase { + resourceGuardResourceId?: string; + resourceGuardOperationDetails?: ResourceGuardOperationDetail[]; + lastUpdatedTime?: string; + description?: string; +} + +export interface ResourceGuardOperationDetail { + vaultCriticalOperation?: string; + defaultResourceRequest?: string; +} + +/** Request body of unlock delete API. */ +export interface UnlockDeleteRequest { + resourceGuardOperationRequests?: string[]; + resourceToBeDeleted?: string; +} + +/** Response of Unlock Delete API. */ +export interface UnlockDeleteResponse { + /** This is the time when unlock delete privileges will get expired. */ + unlockDeleteExpiryTime?: string; +} + +/** Delete Option */ +export interface DeleteOption { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "AbsoluteDeleteOption"; + /** Duration of deletion after given timespan */ + duration: string; +} + +export interface RecoveryPointsFilters { + restorePointDataStoreId?: string; + isVisible?: boolean; + startDate?: string; + endDate?: string; + extendedInfo?: boolean; + restorePointState?: string; +} + +/** Adhoc backup tagging criteria */ +export interface AdhocBasedTaggingCriteria { + /** Retention tag information */ + tagInfo?: RetentionTag; +} + +/** Retention tag */ +export interface RetentionTag { + /** + * Retention Tag version. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly eTag?: string; + /** + * Retention Tag version. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** Retention Tag Name to relate it to retention rule. */ + tagName: string; +} + +/** Trigger context */ +export interface TriggerContext { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "AdhocBasedTriggerContext" | "ScheduleBasedTriggerContext"; +} + +/** RecoveryPoint datastore details */ +export interface RecoveryPointDataStoreDetails { + creationTime?: Date; + expiryTime?: Date; + id?: string; + metaData?: string; + state?: string; + type?: string; + visible?: boolean; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly rehydrationExpiryTime?: Date; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly rehydrationStatus?: RehydrationStatus; +} + +export interface DppWorkerRequest { + subscriptionId?: string; + uri?: string; + /** Dictionary of */ + headers?: { [propertyName: string]: string[] }; + supportedGroupVersions?: string[]; + cultureInfo?: string; + /** Dictionary of */ + parameters?: { [propertyName: string]: string }; + httpMethod?: string; +} + +/** BackupParameters base */ +export interface BackupParameters { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "AzureBackupParams"; +} + +/** DataStoreInfo base */ +export interface DataStoreInfoBase { + /** type of datastore; Operational/Vault/Archive */ + dataStoreType: DataStoreTypes; + /** Type of Datasource object, used to initialize the right inherited type */ + objectType: string; +} + +/** BasePolicy Rule */ +export interface BasePolicyRule { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "AzureBackupRule" | "AzureRetentionRule"; + name: string; +} + +/** Source LifeCycle */ +export interface SourceLifeCycle { + /** Delete Option */ + deleteAfter: DeleteOptionUnion; + /** DataStoreInfo base */ + sourceDataStore: DataStoreInfoBase; + targetDataStoreCopySettings?: TargetCopySetting[]; +} + +/** Target copy settings */ +export interface TargetCopySetting { + /** It can be CustomCopyOption or ImmediateCopyOption. */ + copyAfter: CopyOptionUnion; + /** Info of target datastore */ + dataStore: DataStoreInfoBase; +} + +/** Options to copy */ +export interface CopyOption { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "CopyOnExpiryOption" | "CustomCopyOption" | "ImmediateCopyOption"; +} + +/** BackupCriteria base class */ +export interface BackupCriteria { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "ScheduleBasedBackupCriteria"; +} + +/** Schedule for backup */ +export interface BackupSchedule { + /** ISO 8601 repeating time interval format */ + repeatingTimeIntervals: string[]; + /** Time zone for a schedule. Example: Pacific Standard Time */ + timeZone?: string; +} + +/** Day of the week */ +export interface Day { + /** Date of the month */ + date?: number; + /** Whether Date is last date of month */ + isLast?: boolean; +} + +/** Elements class for feature request */ +export interface SupportedFeature { + /** support feature type. */ + featureName?: string; + /** feature support status */ + supportStatus?: FeatureSupportStatus; + /** support feature type. */ + exposureControlledFeatures?: string[]; +} + +/** Class to contain criteria for item level restore */ +export interface ItemLevelRestoreCriteria { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: + | "ItemPathBasedRestoreCriteria" + | "RangeBasedItemLevelRestoreCriteria" + | "KubernetesStorageClassRestoreCriteria" + | "KubernetesPVRestoreCriteria" + | "KubernetesClusterRestoreCriteria"; +} + +/** Class encapsulating target details, used where the destination is not a datasource */ +export interface TargetDetails { + /** + * Restore operation may create multiple files inside location pointed by Url + * Below will be the common prefix for all of them + */ + filePrefix: string; + /** + * Denotes the target location where the data will be restored, + * string value for the enum {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType} + */ + restoreTargetLocationType: RestoreTargetLocationType; + /** Url denoting the restore destination. It can point to container / file share etc */ + url: string; +} + +/** Tagging criteria */ +export interface TaggingCriteria { + /** Criteria which decides whether the tag can be applied to a triggered backup. */ + criteria?: BackupCriteriaUnion[]; + /** Specifies if tag is default. */ + isDefault: boolean; + /** Retention Tag priority. */ + taggingPriority: number; + /** Retention tag information */ + tagInfo: RetentionTag; +} + +/** Class representing a secret store resource. */ +export interface SecretStoreResource { + /** Uri to get to the resource */ + uri?: string; + /** Gets or sets the type of secret store */ + secretStoreType: SecretStoreType; + /** Gets or sets value stored in secret store resource */ + value?: string; +} + +/** Backup Vault Resource */ +export interface BackupVaultResource extends DppTrackedResource { + /** BackupVaultResource properties */ + properties: BackupVault; +} + +export interface ResourceGuardResource extends DppTrackedResource { + /** ResourceGuardResource properties */ + properties?: ResourceGuard; +} + +/** List of BackupVault resources */ +export interface BackupVaultResourceList extends DppResourceList { + /** List of resources. */ + value?: BackupVaultResource[]; +} + +/** List of BaseBackupPolicy resources */ +export interface BaseBackupPolicyResourceList extends DppResourceList { + /** List of resources. */ + value?: BaseBackupPolicyResource[]; +} + +/** BackupInstance Resource list response */ +export interface BackupInstanceResourceList extends DppResourceList { + /** List of resources. */ + value?: BackupInstanceResource[]; +} + +/** Azure backup recoveryPoint resource list */ +export interface AzureBackupRecoveryPointResourceList extends DppResourceList { + /** List of resources. */ + value?: AzureBackupRecoveryPointResource[]; +} + +/** List of AzureBackup Job resources */ +export interface AzureBackupJobResourceList extends DppResourceList { + /** List of resources. */ + value?: AzureBackupJobResource[]; +} + +/** List of DeletedBackupInstance resources */ +export interface DeletedBackupInstanceResourceList extends DppResourceList { + /** List of resources. */ + value?: DeletedBackupInstanceResource[]; +} + +/** List of ResourceGuardProxyBase resources */ +export interface ResourceGuardProxyBaseResourceList extends DppResourceList { + /** List of resources. */ + value?: ResourceGuardProxyBaseResource[]; +} + +/** Operation Job Extended Info */ +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. */ + jobId?: string; +} + +/** Base class for feature object */ +export interface FeatureValidationRequest extends FeatureValidationRequestBase { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "FeatureValidationRequest"; + /** backup support feature type. */ + featureType?: FeatureType; + /** backup support feature name. */ + featureName?: string; +} + +/** Feature Validation Response */ +export interface FeatureValidationResponse + extends FeatureValidationResponseBase { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "FeatureValidationResponse"; + /** backup support feature type. */ + featureType?: FeatureType; + /** Response features */ + features?: SupportedFeature[]; +} + +/** Rule based backup policy */ +export interface BackupPolicy extends BaseBackupPolicy { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "BackupPolicy"; + /** Policy rule dictionary that contains rules for each backuptype i.e Full/Incremental/Logs etc */ + policyRules: BasePolicyRuleUnion[]; +} + +/** BaseBackupPolicy resource */ +export interface BaseBackupPolicyResource extends DppResource { + /** BaseBackupPolicyResource properties */ + properties?: BaseBackupPolicyUnion; +} + +/** Azure backup recoveryPoint resource */ +export interface AzureBackupRecoveryPointResource extends DppResource { + /** AzureBackupRecoveryPointResource properties */ + properties?: AzureBackupRecoveryPointUnion; +} + +/** AzureBackup Job Resource Class */ +export interface AzureBackupJobResource extends DppResource { + /** AzureBackupJobResource properties */ + properties?: AzureBackupJob; +} + +/** List Restore Ranges Response */ +export interface AzureBackupFindRestorableTimeRangesResponseResource + extends DppResource { + /** AzureBackupFindRestorableTimeRangesResponseResource properties */ + properties?: AzureBackupFindRestorableTimeRangesResponse; +} + +/** Deleted Backup Instance */ +export interface DeletedBackupInstanceResource extends DppResource { + /** DeletedBackupInstanceResource properties */ + properties?: DeletedBackupInstance; +} + +export interface ResourceGuardProxyBaseResource extends DppResource { + /** ResourceGuardProxyBaseResource properties */ + properties?: ResourceGuardProxyBase; +} + +/** Deleted Backup Instance */ +export interface DeletedBackupInstance extends BackupInstance { + /** + * Deletion info of Backup Instance + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly deletionInfo?: DeletionInfo; +} + +/** Parameters for Operational-Tier DataStore */ +export interface AzureOperationalStoreParameters extends DataStoreParameters { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "AzureOperationalStoreParameters"; + /** Gets or sets the Snapshot Resource Group Uri. */ + resourceGroupId?: string; +} + +/** Parameters for Kubernetes Cluster Backup Datasource */ +export interface KubernetesClusterBackupDatasourceParameters + extends BackupDatasourceParameters { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "KubernetesClusterBackupDatasourceParameters"; + /** Gets or sets the volume snapshot property. This property if enabled will take volume snapshots during restore. */ + snapshotVolumes: boolean; + /** Gets or sets the include cluster resources property. This property if enabled will include cluster scope resources during restore. */ + includeClusterScopeResources: boolean; + /** Gets or sets the include namespaces property. This property sets the namespaces to be included during restore. */ + includedNamespaces?: string[]; + /** Gets or sets the exclude namespaces property. This property sets the namespaces to be excluded during restore. */ + excludedNamespaces?: string[]; + /** Gets or sets the include resource types property. This property sets the resource types to be included during restore. */ + includedResourceTypes?: string[]; + /** Gets or sets the exclude resource types property. This property sets the resource types to be excluded during restore. */ + excludedResourceTypes?: string[]; + /** Gets or sets the LabelSelectors property. This property sets the resource with such label selectors to be included during restore. */ + labelSelectors?: string[]; +} + +/** Parameters to be used during configuration of backup of blobs */ +export interface BlobBackupDatasourceParameters + extends BackupDatasourceParameters { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "BlobBackupDatasourceParameters"; + /** List of containers to be backed up during configuration of backup of blobs */ + containersList: string[]; +} + +/** Secret store based authentication credentials. */ +export interface SecretStoreBasedAuthCredentials extends AuthCredentials { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "SecretStoreBasedAuthCredentials"; + /** Secret store resource */ + secretStoreResource?: SecretStoreResource; +} + +/** BackupInstance Resource */ +export interface BackupInstanceResource extends DppProxyResource { + /** BackupInstanceResource properties */ + properties?: BackupInstance; +} + +/** Azure backup discrete RecoveryPoint */ +export interface AzureBackupDiscreteRecoveryPoint + extends AzureBackupRecoveryPoint { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "AzureBackupDiscreteRecoveryPoint"; + friendlyName?: string; + recoveryPointDataStoresDetails?: RecoveryPointDataStoreDetails[]; + recoveryPointTime: Date; + policyName?: string; + policyVersion?: string; + recoveryPointId?: string; + recoveryPointType?: string; + retentionTagName?: string; + retentionTagVersion?: string; +} + +/** Azure backup recoveryPoint based restore request */ +export interface AzureBackupRecoveryPointBasedRestoreRequest + extends AzureBackupRestoreRequest { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: + | "AzureBackupRecoveryPointBasedRestoreRequest" + | "AzureBackupRestoreWithRehydrationRequest"; + recoveryPointId: string; +} + +/** AzureBackup RecoveryPointTime Based Restore Request */ +export interface AzureBackupRecoveryTimeBasedRestoreRequest + extends AzureBackupRestoreRequest { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "AzureBackupRecoveryTimeBasedRestoreRequest"; + /** The recovery time in ISO 8601 format example - 2020-08-14T17:30:00.0000000Z. */ + recoveryPointTime: string; +} + +/** Restore target info for Item level restore operation */ +export interface ItemLevelRestoreTargetInfo extends RestoreTargetInfoBase { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "ItemLevelRestoreTargetInfo"; + /** Restore Criteria */ + restoreCriteria: ItemLevelRestoreCriteriaUnion[]; + /** Information of target DS */ + datasourceInfo: Datasource; + /** Information of target DS Set */ + datasourceSetInfo?: DatasourceSet; + /** Credentials to use to authenticate with data source provider. */ + datasourceAuthCredentials?: AuthCredentialsUnion; +} + +/** Class encapsulating restore as files target parameters */ +export interface RestoreFilesTargetInfo extends RestoreTargetInfoBase { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "RestoreFilesTargetInfo"; + /** Destination of RestoreAsFiles operation, when destination is not a datasource */ + targetDetails: TargetDetails; +} + +/** Class encapsulating restore target parameters */ +export interface RestoreTargetInfo extends RestoreTargetInfoBase { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "RestoreTargetInfo"; + /** Information of target DS */ + datasourceInfo: Datasource; + /** Information of target DS Set */ + datasourceSetInfo?: DatasourceSet; + /** Credentials to use to authenticate with data source provider. */ + datasourceAuthCredentials?: AuthCredentialsUnion; +} + +/** List of ResourceGuard resources */ +export interface ResourceGuardResourceList extends DppTrackedResourceList { + /** List of resources. */ + value?: ResourceGuardResource[]; +} + +/** Delete option with duration */ +export interface AbsoluteDeleteOption extends DeleteOption { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "AbsoluteDeleteOption"; +} + +/** Adhoc trigger context */ +export interface AdhocBasedTriggerContext extends TriggerContext { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "AdhocBasedTriggerContext"; + /** Tagging Criteria containing retention tag for adhoc backup. */ + taggingCriteria: AdhocBasedTaggingCriteria; +} + +/** Schedule based trigger context */ +export interface ScheduleBasedTriggerContext extends TriggerContext { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "ScheduleBasedTriggerContext"; + /** Schedule for this backup */ + schedule: BackupSchedule; + /** List of tags that can be applicable for given schedule. */ + taggingCriteria: TaggingCriteria[]; +} + +/** List Restore Ranges Request */ +export interface AzureBackupFindRestorableTimeRangesRequestResource + extends DppWorkerRequest { + /** AzureBackupFindRestorableTimeRangesRequestResource content */ + content?: AzureBackupFindRestorableTimeRangesRequest; +} + +/** Azure backup parameters */ +export interface AzureBackupParams extends BackupParameters { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "AzureBackupParams"; + /** BackupType ; Full/Incremental etc */ + backupType: string; +} + +/** Azure backup rule */ +export interface AzureBackupRule extends BasePolicyRule { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "AzureBackupRule"; + /** BackupParameters base */ + backupParameters?: BackupParametersUnion; + /** DataStoreInfo base */ + dataStore: DataStoreInfoBase; + /** Trigger context */ + trigger: TriggerContextUnion; +} + +/** Azure retention rule */ +export interface AzureRetentionRule extends BasePolicyRule { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "AzureRetentionRule"; + isDefault?: boolean; + lifecycles: SourceLifeCycle[]; +} + +/** Copy on Expiry Option */ +export interface CopyOnExpiryOption extends CopyOption { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "CopyOnExpiryOption"; +} + +/** Duration based custom options to copy */ +export interface CustomCopyOption extends CopyOption { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "CustomCopyOption"; + /** Data copied after given timespan */ + duration?: string; +} + +/** Immediate copy Option */ +export interface ImmediateCopyOption extends CopyOption { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "ImmediateCopyOption"; +} + +/** Schedule based backup criteria */ +export interface ScheduleBasedBackupCriteria extends BackupCriteria { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "ScheduleBasedBackupCriteria"; + /** + * it contains absolute values like "AllBackup" / "FirstOfDay" / "FirstOfWeek" / "FirstOfMonth" + * and should be part of AbsoluteMarker enum + */ + absoluteCriteria?: AbsoluteMarker[]; + /** This is day of the month from 1 to 28 other wise last of month */ + daysOfMonth?: Day[]; + /** It should be Sunday/Monday/T..../Saturday */ + daysOfTheWeek?: DayOfWeek[]; + /** It should be January/February/....../December */ + monthsOfYear?: Month[]; + /** List of schedule times for backup */ + scheduleTimes?: Date[]; + /** It should be First/Second/Third/Fourth/Last */ + weeksOfTheMonth?: WeekNumber[]; +} + +/** Prefix criteria to be used to during restore */ +export interface ItemPathBasedRestoreCriteria extends ItemLevelRestoreCriteria { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "ItemPathBasedRestoreCriteria"; + /** The path of the item to be restored. It could be the full path of the item or the path relative to the backup item */ + itemPath: string; + /** Flag to specify if the path is relative to backup item or full path */ + isPathRelativeToBackupItem: boolean; + /** The list of prefix strings to be used as filter criteria during restore. These are relative to the item path specified. */ + subItemPathPrefix?: string[]; +} + +/** Item Level target info for restore operation */ +export interface RangeBasedItemLevelRestoreCriteria + extends ItemLevelRestoreCriteria { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "RangeBasedItemLevelRestoreCriteria"; + /** minimum value for range prefix match */ + minMatchingValue?: string; + /** maximum value for range prefix match */ + maxMatchingValue?: string; +} + +/** Item Level kubernetes storage class target info for restore operation */ +export interface KubernetesStorageClassRestoreCriteria + extends ItemLevelRestoreCriteria { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "KubernetesStorageClassRestoreCriteria"; + /** Selected storage class name */ + selectedStorageClassName?: string; + /** Provisioner of the storage class */ + provisioner?: string; +} + +/** Item Level kubernetes persistent volume target info for restore operation */ +export interface KubernetesPVRestoreCriteria extends ItemLevelRestoreCriteria { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "KubernetesPVRestoreCriteria"; + /** Selected persistent volume claim name */ + name?: string; + /** Selected storage class name for restore operation */ + storageClassName?: string; +} + +/** kubernetes Cluster Backup target info for restore operation */ +export interface KubernetesClusterRestoreCriteria + extends ItemLevelRestoreCriteria { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "KubernetesClusterRestoreCriteria"; + /** Gets or sets the include cluster resources property. This property if enabled will include cluster scope resources during restore. */ + includeClusterScopeResources: boolean; + /** Gets or sets the include namespaces property. This property sets the namespaces to be included during restore. */ + includedNamespaces?: string[]; + /** Gets or sets the exclude namespaces property. This property sets the namespaces to be excluded during restore. */ + excludedNamespaces?: string[]; + /** Gets or sets the include resource types property. This property sets the resource types to be included during restore. */ + includedResourceTypes?: string[]; + /** Gets or sets the exclude resource types property. This property sets the resource types to be excluded during restore. */ + excludedResourceTypes?: string[]; + /** Gets or sets the LabelSelectors property. This property sets the resource with such label selectors to be included during restore. */ + labelSelectors?: string[]; + /** Gets or sets the PV Restore Mode property. This property sets whether volumes needs to be restored. */ + persistentVolumeRestoreMode?: PersistentVolumeRestoreMode; + /** Gets or sets the Conflict Policy property. This property sets policy during conflict of resources during restore. */ + conflictPolicy?: ExistingResourcePolicy; + /** Gets or sets the Namespace Mappings property. This property sets if namespace needs to be change during restore. */ + namespaceMappings?: { [propertyName: string]: string }; +} + +/** AzureBackup Restore with Rehydration Request */ +export interface AzureBackupRestoreWithRehydrationRequest + extends AzureBackupRecoveryPointBasedRestoreRequest { + /** Polymorphic discriminator, which specifies the different types this object can be */ + objectType: "AzureBackupRestoreWithRehydrationRequest"; + /** Priority to be used for rehydration. Values High or Standard */ + rehydrationPriority: RehydrationPriority; + /** Retention duration in ISO 8601 format i.e P10D . */ + rehydrationRetentionDuration: string; +} + +/** Defines headers for OperationResult_get operation. */ +export interface OperationResultGetHeaders { + /** 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 BackupVaultOperationResults_get operation. */ +export interface BackupVaultOperationResultsGetHeaders { + /** 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_createOrUpdate operation. */ +export interface BackupInstancesCreateOrUpdateHeaders { + /** 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; +} + +/** Defines headers for BackupInstances_delete operation. */ +export interface BackupInstancesDeleteHeaders { + /** 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_adhocBackup operation. */ +export interface BackupInstancesAdhocBackupHeaders { + /** 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_validateForBackup operation. */ +export interface BackupInstancesValidateForBackupHeaders { + /** 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. */ + 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_triggerRestore operation. */ +export interface BackupInstancesTriggerRestoreHeaders { + /** 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_resumeBackups operation. */ +export interface BackupInstancesResumeBackupsHeaders { + /** 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_resumeProtection operation. */ +export interface BackupInstancesResumeProtectionHeaders { + /** 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_stopProtection operation. */ +export interface BackupInstancesStopProtectionHeaders { + /** 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_suspendBackups operation. */ +export interface BackupInstancesSuspendBackupsHeaders { + /** 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_syncBackupInstance operation. */ +export interface BackupInstancesSyncBackupInstanceHeaders { + /** 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_validateForRestore operation. */ +export interface BackupInstancesValidateForRestoreHeaders { + /** 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 ExportJobs_trigger operation. */ +export interface ExportJobsTriggerHeaders { + /** The URL of the resource used to check the status of the asynchronous operation. */ + location?: string; + /** Suggested delay to check the status of the asynchronous operation. The value is an integer that represents the seconds. */ + retryAfter?: number; +} + +/** Known values of {@link AlertsState} that the service accepts. */ +export enum KnownAlertsState { + /** Enabled */ + Enabled = "Enabled", + /** Disabled */ + Disabled = "Disabled" +} + +/** + * Defines values for AlertsState. \ + * {@link KnownAlertsState} can be used interchangeably with AlertsState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type AlertsState = string; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + /** Failed */ + Failed = "Failed", + /** Provisioning */ + Provisioning = "Provisioning", + /** Succeeded */ + Succeeded = "Succeeded", + /** Unknown */ + Unknown = "Unknown", + /** Updating */ + Updating = "Updating" +} + +/** + * Defines values for ProvisioningState. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Failed** \ + * **Provisioning** \ + * **Succeeded** \ + * **Unknown** \ + * **Updating** + */ +export type ProvisioningState = string; + +/** Known values of {@link ResourceMoveState} that the service accepts. */ +export enum KnownResourceMoveState { + /** Unknown */ + Unknown = "Unknown", + /** InProgress */ + InProgress = "InProgress", + /** PrepareFailed */ + PrepareFailed = "PrepareFailed", + /** CommitFailed */ + CommitFailed = "CommitFailed", + /** Failed */ + Failed = "Failed", + /** PrepareTimedout */ + PrepareTimedout = "PrepareTimedout", + /** CommitTimedout */ + CommitTimedout = "CommitTimedout", + /** CriticalFailure */ + CriticalFailure = "CriticalFailure", + /** PartialSuccess */ + PartialSuccess = "PartialSuccess", + /** MoveSucceeded */ + MoveSucceeded = "MoveSucceeded" +} + +/** + * Defines values for ResourceMoveState. \ + * {@link KnownResourceMoveState} can be used interchangeably with ResourceMoveState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unknown** \ + * **InProgress** \ + * **PrepareFailed** \ + * **CommitFailed** \ + * **Failed** \ + * **PrepareTimedout** \ + * **CommitTimedout** \ + * **CriticalFailure** \ + * **PartialSuccess** \ + * **MoveSucceeded** + */ +export type ResourceMoveState = string; + +/** Known values of {@link SoftDeleteState} that the service accepts. */ +export enum KnownSoftDeleteState { + /** Soft Delete is turned off for the BackupVault */ + Off = "Off", + /** Soft Delete is enabled for the BackupVault but can be turned off */ + On = "On", + /** Soft Delete is permanently enabled for the BackupVault and the setting cannot be changed */ + AlwaysOn = "AlwaysOn" +} + +/** + * Defines values for SoftDeleteState. \ + * {@link KnownSoftDeleteState} can be used interchangeably with SoftDeleteState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Off**: Soft Delete is turned off for the BackupVault \ + * **On**: Soft Delete is enabled for the BackupVault but can be turned off \ + * **AlwaysOn**: Soft Delete is permanently enabled for the BackupVault and the setting cannot be changed + */ +export type SoftDeleteState = string; + +/** Known values of {@link ImmutabilityState} that the service accepts. */ +export enum KnownImmutabilityState { + /** Disabled */ + Disabled = "Disabled", + /** Unlocked */ + Unlocked = "Unlocked", + /** Locked */ + Locked = "Locked" +} + +/** + * Defines values for ImmutabilityState. \ + * {@link KnownImmutabilityState} can be used interchangeably with ImmutabilityState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Disabled** \ + * **Unlocked** \ + * **Locked** + */ +export type ImmutabilityState = string; + +/** Known values of {@link StorageSettingStoreTypes} that the service accepts. */ +export enum KnownStorageSettingStoreTypes { + /** ArchiveStore */ + ArchiveStore = "ArchiveStore", + /** SnapshotStore */ + SnapshotStore = "SnapshotStore", + /** VaultStore */ + VaultStore = "VaultStore" +} + +/** + * Defines values for StorageSettingStoreTypes. \ + * {@link KnownStorageSettingStoreTypes} can be used interchangeably with StorageSettingStoreTypes, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ArchiveStore** \ + * **SnapshotStore** \ + * **VaultStore** + */ +export type StorageSettingStoreTypes = string; + +/** Known values of {@link StorageSettingTypes} that the service accepts. */ +export enum KnownStorageSettingTypes { + /** GeoRedundant */ + GeoRedundant = "GeoRedundant", + /** LocallyRedundant */ + LocallyRedundant = "LocallyRedundant", + /** ZoneRedundant */ + ZoneRedundant = "ZoneRedundant" +} + +/** + * Defines values for StorageSettingTypes. \ + * {@link KnownStorageSettingTypes} can be used interchangeably with StorageSettingTypes, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **GeoRedundant** \ + * **LocallyRedundant** \ + * **ZoneRedundant** + */ +export type StorageSettingTypes = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + /** User */ + User = "User", + /** Application */ + Application = "Application", + /** ManagedIdentity */ + ManagedIdentity = "ManagedIdentity", + /** Key */ + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Known values of {@link DataStoreTypes} that the service accepts. */ +export enum KnownDataStoreTypes { + /** OperationalStore */ + OperationalStore = "OperationalStore", + /** VaultStore */ + VaultStore = "VaultStore", + /** ArchiveStore */ + ArchiveStore = "ArchiveStore" +} + +/** + * Defines values for DataStoreTypes. \ + * {@link KnownDataStoreTypes} can be used interchangeably with DataStoreTypes, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **OperationalStore** \ + * **VaultStore** \ + * **ArchiveStore** + */ +export type DataStoreTypes = string; + +/** Known values of {@link Status} that the service accepts. */ +export enum KnownStatus { + /** ConfiguringProtection */ + ConfiguringProtection = "ConfiguringProtection", + /** ConfiguringProtectionFailed */ + ConfiguringProtectionFailed = "ConfiguringProtectionFailed", + /** ProtectionConfigured */ + ProtectionConfigured = "ProtectionConfigured", + /** ProtectionStopped */ + ProtectionStopped = "ProtectionStopped", + /** SoftDeleted */ + SoftDeleted = "SoftDeleted", + /** SoftDeleting */ + SoftDeleting = "SoftDeleting" +} + +/** + * Defines values for Status. \ + * {@link KnownStatus} can be used interchangeably with Status, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ConfiguringProtection** \ + * **ConfiguringProtectionFailed** \ + * **ProtectionConfigured** \ + * **ProtectionStopped** \ + * **SoftDeleted** \ + * **SoftDeleting** + */ +export type Status = string; + +/** Known values of {@link CurrentProtectionState} that the service accepts. */ +export enum KnownCurrentProtectionState { + /** Invalid */ + Invalid = "Invalid", + /** NotProtected */ + NotProtected = "NotProtected", + /** ConfiguringProtection */ + ConfiguringProtection = "ConfiguringProtection", + /** ProtectionConfigured */ + ProtectionConfigured = "ProtectionConfigured", + /** BackupSchedulesSuspended */ + BackupSchedulesSuspended = "BackupSchedulesSuspended", + /** RetentionSchedulesSuspended */ + RetentionSchedulesSuspended = "RetentionSchedulesSuspended", + /** ProtectionStopped */ + ProtectionStopped = "ProtectionStopped", + /** ProtectionError */ + ProtectionError = "ProtectionError", + /** ConfiguringProtectionFailed */ + ConfiguringProtectionFailed = "ConfiguringProtectionFailed", + /** SoftDeleting */ + SoftDeleting = "SoftDeleting", + /** SoftDeleted */ + SoftDeleted = "SoftDeleted", + /** UpdatingProtection */ + UpdatingProtection = "UpdatingProtection" +} + +/** + * Defines values for CurrentProtectionState. \ + * {@link KnownCurrentProtectionState} can be used interchangeably with CurrentProtectionState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Invalid** \ + * **NotProtected** \ + * **ConfiguringProtection** \ + * **ProtectionConfigured** \ + * **BackupSchedulesSuspended** \ + * **RetentionSchedulesSuspended** \ + * **ProtectionStopped** \ + * **ProtectionError** \ + * **ConfiguringProtectionFailed** \ + * **SoftDeleting** \ + * **SoftDeleted** \ + * **UpdatingProtection** + */ +export type CurrentProtectionState = string; + +/** Known values of {@link ValidationType} that the service accepts. */ +export enum KnownValidationType { + /** ShallowValidation */ + ShallowValidation = "ShallowValidation", + /** DeepValidation */ + DeepValidation = "DeepValidation" +} + +/** + * Defines values for ValidationType. \ + * {@link KnownValidationType} can be used interchangeably with ValidationType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ShallowValidation** \ + * **DeepValidation** + */ +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 */ + FailIfExists = "FailIfExists" +} + +/** + * Defines values for RecoveryOption. \ + * {@link KnownRecoveryOption} can be used interchangeably with RecoveryOption, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **FailIfExists** + */ +export type RecoveryOption = string; + +/** Known values of {@link SourceDataStoreType} that the service accepts. */ +export enum KnownSourceDataStoreType { + /** ArchiveStore */ + ArchiveStore = "ArchiveStore", + /** SnapshotStore */ + SnapshotStore = "SnapshotStore", + /** VaultStore */ + VaultStore = "VaultStore" +} + +/** + * Defines values for SourceDataStoreType. \ + * {@link KnownSourceDataStoreType} can be used interchangeably with SourceDataStoreType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ArchiveStore** \ + * **SnapshotStore** \ + * **VaultStore** + */ +export type SourceDataStoreType = string; + +/** Known values of {@link SyncType} that the service accepts. */ +export enum KnownSyncType { + /** Default */ + Default = "Default", + /** ForceResync */ + ForceResync = "ForceResync" +} + +/** + * Defines values for SyncType. \ + * {@link KnownSyncType} can be used interchangeably with SyncType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Default** \ + * **ForceResync** + */ +export type SyncType = string; + +/** Known values of {@link RestoreSourceDataStoreType} that the service accepts. */ +export enum KnownRestoreSourceDataStoreType { + /** OperationalStore */ + OperationalStore = "OperationalStore", + /** VaultStore */ + VaultStore = "VaultStore", + /** ArchiveStore */ + ArchiveStore = "ArchiveStore" +} + +/** + * Defines values for RestoreSourceDataStoreType. \ + * {@link KnownRestoreSourceDataStoreType} can be used interchangeably with RestoreSourceDataStoreType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **OperationalStore** \ + * **VaultStore** \ + * **ArchiveStore** + */ +export type RestoreSourceDataStoreType = string; + +/** Known values of {@link ResourceGuardProvisioningState} that the service accepts. */ +export enum KnownResourceGuardProvisioningState { + /** Failed */ + Failed = "Failed", + /** Provisioning */ + Provisioning = "Provisioning", + /** Succeeded */ + Succeeded = "Succeeded", + /** Unknown */ + Unknown = "Unknown", + /** Updating */ + Updating = "Updating" +} + +/** + * Defines values for ResourceGuardProvisioningState. \ + * {@link KnownResourceGuardProvisioningState} can be used interchangeably with ResourceGuardProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Failed** \ + * **Provisioning** \ + * **Succeeded** \ + * **Unknown** \ + * **Updating** + */ +export type ResourceGuardProvisioningState = string; + +/** Known values of {@link RehydrationStatus} that the service accepts. */ +export enum KnownRehydrationStatus { + /** CreateINProgress */ + CreateINProgress = "CREATE_IN_PROGRESS", + /** Completed */ + Completed = "COMPLETED", + /** DeleteINProgress */ + DeleteINProgress = "DELETE_IN_PROGRESS", + /** Deleted */ + Deleted = "DELETED", + /** Failed */ + Failed = "FAILED" +} + +/** + * Defines values for RehydrationStatus. \ + * {@link KnownRehydrationStatus} can be used interchangeably with RehydrationStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **CREATE_IN_PROGRESS** \ + * **COMPLETED** \ + * **DELETE_IN_PROGRESS** \ + * **DELETED** \ + * **FAILED** + */ +export type RehydrationStatus = string; + +/** Known values of {@link FeatureType} that the service accepts. */ +export enum KnownFeatureType { + /** Invalid */ + Invalid = "Invalid", + /** DataSourceType */ + DataSourceType = "DataSourceType" +} + +/** + * Defines values for FeatureType. \ + * {@link KnownFeatureType} can be used interchangeably with FeatureType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Invalid** \ + * **DataSourceType** + */ +export type FeatureType = string; + +/** Known values of {@link FeatureSupportStatus} that the service accepts. */ +export enum KnownFeatureSupportStatus { + /** Invalid */ + Invalid = "Invalid", + /** NotSupported */ + NotSupported = "NotSupported", + /** AlphaPreview */ + AlphaPreview = "AlphaPreview", + /** PrivatePreview */ + PrivatePreview = "PrivatePreview", + /** PublicPreview */ + PublicPreview = "PublicPreview", + /** GenerallyAvailable */ + GenerallyAvailable = "GenerallyAvailable" +} + +/** + * Defines values for FeatureSupportStatus. \ + * {@link KnownFeatureSupportStatus} can be used interchangeably with FeatureSupportStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Invalid** \ + * **NotSupported** \ + * **AlphaPreview** \ + * **PrivatePreview** \ + * **PublicPreview** \ + * **GenerallyAvailable** + */ +export type FeatureSupportStatus = string; + +/** Known values of {@link PersistentVolumeRestoreMode} that the service accepts. */ +export enum KnownPersistentVolumeRestoreMode { + /** RestoreWithVolumeData */ + RestoreWithVolumeData = "RestoreWithVolumeData", + /** RestoreWithoutVolumeData */ + RestoreWithoutVolumeData = "RestoreWithoutVolumeData" +} + +/** + * Defines values for PersistentVolumeRestoreMode. \ + * {@link KnownPersistentVolumeRestoreMode} can be used interchangeably with PersistentVolumeRestoreMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **RestoreWithVolumeData** \ + * **RestoreWithoutVolumeData** + */ +export type PersistentVolumeRestoreMode = string; + +/** Known values of {@link ExistingResourcePolicy} that the service accepts. */ +export enum KnownExistingResourcePolicy { + /** Skip */ + Skip = "Skip", + /** Patch */ + Patch = "Patch" +} + +/** + * Defines values for ExistingResourcePolicy. \ + * {@link KnownExistingResourcePolicy} can be used interchangeably with ExistingResourcePolicy, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Skip** \ + * **Patch** + */ +export type ExistingResourcePolicy = string; + +/** Known values of {@link RestoreTargetLocationType} that the service accepts. */ +export enum KnownRestoreTargetLocationType { + /** Invalid */ + Invalid = "Invalid", + /** AzureBlobs */ + AzureBlobs = "AzureBlobs", + /** AzureFiles */ + AzureFiles = "AzureFiles" +} + +/** + * Defines values for RestoreTargetLocationType. \ + * {@link KnownRestoreTargetLocationType} can be used interchangeably with RestoreTargetLocationType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Invalid** \ + * **AzureBlobs** \ + * **AzureFiles** + */ +export type RestoreTargetLocationType = string; + +/** Known values of {@link AbsoluteMarker} that the service accepts. */ +export enum KnownAbsoluteMarker { + /** AllBackup */ + AllBackup = "AllBackup", + /** FirstOfDay */ + FirstOfDay = "FirstOfDay", + /** FirstOfMonth */ + FirstOfMonth = "FirstOfMonth", + /** FirstOfWeek */ + FirstOfWeek = "FirstOfWeek", + /** FirstOfYear */ + FirstOfYear = "FirstOfYear" +} + +/** + * Defines values for AbsoluteMarker. \ + * {@link KnownAbsoluteMarker} can be used interchangeably with AbsoluteMarker, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AllBackup** \ + * **FirstOfDay** \ + * **FirstOfMonth** \ + * **FirstOfWeek** \ + * **FirstOfYear** + */ +export type AbsoluteMarker = string; + +/** Known values of {@link DayOfWeek} that the service accepts. */ +export enum KnownDayOfWeek { + /** Friday */ + Friday = "Friday", + /** Monday */ + Monday = "Monday", + /** Saturday */ + Saturday = "Saturday", + /** Sunday */ + Sunday = "Sunday", + /** Thursday */ + Thursday = "Thursday", + /** Tuesday */ + Tuesday = "Tuesday", + /** Wednesday */ + Wednesday = "Wednesday" +} + +/** + * Defines values for DayOfWeek. \ + * {@link KnownDayOfWeek} can be used interchangeably with DayOfWeek, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Friday** \ + * **Monday** \ + * **Saturday** \ + * **Sunday** \ + * **Thursday** \ + * **Tuesday** \ + * **Wednesday** + */ +export type DayOfWeek = string; + +/** Known values of {@link Month} that the service accepts. */ +export enum KnownMonth { + /** April */ + April = "April", + /** August */ + August = "August", + /** December */ + December = "December", + /** February */ + February = "February", + /** January */ + January = "January", + /** July */ + July = "July", + /** June */ + June = "June", + /** March */ + March = "March", + /** May */ + May = "May", + /** November */ + November = "November", + /** October */ + October = "October", + /** September */ + September = "September" +} + +/** + * Defines values for Month. \ + * {@link KnownMonth} can be used interchangeably with Month, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **April** \ + * **August** \ + * **December** \ + * **February** \ + * **January** \ + * **July** \ + * **June** \ + * **March** \ + * **May** \ + * **November** \ + * **October** \ + * **September** + */ +export type Month = string; + +/** Known values of {@link WeekNumber} that the service accepts. */ +export enum KnownWeekNumber { + /** First */ + First = "First", + /** Fourth */ + Fourth = "Fourth", + /** Last */ + Last = "Last", + /** Second */ + Second = "Second", + /** Third */ + Third = "Third" +} + +/** + * Defines values for WeekNumber. \ + * {@link KnownWeekNumber} can be used interchangeably with WeekNumber, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **First** \ + * **Fourth** \ + * **Last** \ + * **Second** \ + * **Third** + */ +export type WeekNumber = string; + +/** Known values of {@link SecretStoreType} that the service accepts. */ +export enum KnownSecretStoreType { + /** Invalid */ + Invalid = "Invalid", + /** AzureKeyVault */ + AzureKeyVault = "AzureKeyVault" +} + +/** + * Defines values for SecretStoreType. \ + * {@link KnownSecretStoreType} can be used interchangeably with SecretStoreType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Invalid** \ + * **AzureKeyVault** + */ +export type SecretStoreType = string; + +/** Optional parameters. */ +export interface BackupVaultsGetInSubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getInSubscription operation. */ +export type BackupVaultsGetInSubscriptionResponse = BackupVaultResourceList; + +/** Optional parameters. */ +export interface BackupVaultsGetInResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getInResourceGroup operation. */ +export type BackupVaultsGetInResourceGroupResponse = BackupVaultResourceList; + +/** Optional parameters. */ +export interface BackupVaultsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type BackupVaultsGetResponse = BackupVaultResource; + +/** Optional parameters. */ +export interface BackupVaultsCreateOrUpdateOptionalParams + 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 createOrUpdate operation. */ +export type BackupVaultsCreateOrUpdateResponse = BackupVaultResource; + +/** Optional parameters. */ +export interface BackupVaultsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface BackupVaultsUpdateOptionalParams + 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 update operation. */ +export type BackupVaultsUpdateResponse = BackupVaultResource; + +/** Optional parameters. */ +export interface BackupVaultsCheckNameAvailabilityOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the checkNameAvailability operation. */ +export type BackupVaultsCheckNameAvailabilityResponse = CheckNameAvailabilityResult; + +/** Optional parameters. */ +export interface BackupVaultsGetInSubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getInSubscriptionNext operation. */ +export type BackupVaultsGetInSubscriptionNextResponse = BackupVaultResourceList; + +/** Optional parameters. */ +export interface BackupVaultsGetInResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getInResourceGroupNext operation. */ +export type BackupVaultsGetInResourceGroupNextResponse = BackupVaultResourceList; + +/** Optional parameters. */ +export interface OperationResultGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type OperationResultGetResponse = OperationJobExtendedInfo; + +/** Optional parameters. */ +export interface OperationStatusGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type OperationStatusGetResponse = OperationResource; + +/** Optional parameters. */ +export interface OperationStatusBackupVaultContextGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type OperationStatusBackupVaultContextGetResponse = OperationResource; + +/** Optional parameters. */ +export interface OperationStatusResourceGroupContextGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type OperationStatusResourceGroupContextGetResponse = OperationResource; + +/** Optional parameters. */ +export interface BackupVaultOperationResultsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type BackupVaultOperationResultsGetResponse = BackupVaultResource; + +/** Optional parameters. */ +export interface DataProtectionCheckFeatureSupportOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the checkFeatureSupport operation. */ +export type DataProtectionCheckFeatureSupportResponse = FeatureValidationResponseBaseUnion; + +/** Optional parameters. */ +export interface DataProtectionOperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type DataProtectionOperationsListResponse = ClientDiscoveryResponse; + +/** Optional parameters. */ +export interface DataProtectionOperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type DataProtectionOperationsListNextResponse = ClientDiscoveryResponse; + +/** Optional parameters. */ +export interface BackupPoliciesListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type BackupPoliciesListResponse = BaseBackupPolicyResourceList; + +/** Optional parameters. */ +export interface BackupPoliciesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type BackupPoliciesGetResponse = BaseBackupPolicyResource; + +/** Optional parameters. */ +export interface BackupPoliciesCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type BackupPoliciesCreateOrUpdateResponse = BaseBackupPolicyResource; + +/** Optional parameters. */ +export interface BackupPoliciesDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface BackupPoliciesListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type BackupPoliciesListNextResponse = BaseBackupPolicyResourceList; + +/** Optional parameters. */ +export interface BackupInstancesListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type BackupInstancesListResponse = BackupInstanceResourceList; + +/** Optional parameters. */ +export interface BackupInstancesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type BackupInstancesGetResponse = BackupInstanceResource; + +/** Optional parameters. */ +export interface BackupInstancesCreateOrUpdateOptionalParams + 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 createOrUpdate operation. */ +export type BackupInstancesCreateOrUpdateResponse = BackupInstanceResource; + +/** Optional parameters. */ +export interface BackupInstancesDeleteOptionalParams + 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; +} + +/** Optional parameters. */ +export interface BackupInstancesAdhocBackupOptionalParams + 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 adhocBackup operation. */ +export type BackupInstancesAdhocBackupResponse = OperationJobExtendedInfo; + +/** Optional parameters. */ +export interface BackupInstancesValidateForBackupOptionalParams + 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 validateForBackup operation. */ +export type BackupInstancesValidateForBackupResponse = OperationJobExtendedInfo; + +/** Optional parameters. */ +export interface BackupInstancesGetBackupInstanceOperationResultOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getBackupInstanceOperationResult operation. */ +export type BackupInstancesGetBackupInstanceOperationResultResponse = BackupInstanceResource; + +/** Optional parameters. */ +export interface BackupInstancesTriggerRehydrateOptionalParams + 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 triggerRehydrate operation. */ +export type BackupInstancesTriggerRehydrateResponse = BackupInstancesTriggerRehydrateHeaders; + +/** Optional parameters. */ +export interface BackupInstancesTriggerRestoreOptionalParams + 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 triggerRestore operation. */ +export type BackupInstancesTriggerRestoreResponse = OperationJobExtendedInfo; + +/** Optional parameters. */ +export interface BackupInstancesResumeBackupsOptionalParams + 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; +} + +/** Optional parameters. */ +export interface BackupInstancesResumeProtectionOptionalParams + 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; +} + +/** Optional parameters. */ +export interface BackupInstancesStopProtectionOptionalParams + 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; +} + +/** Optional parameters. */ +export interface BackupInstancesSuspendBackupsOptionalParams + 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; +} + +/** Optional parameters. */ +export interface BackupInstancesSyncBackupInstanceOptionalParams + 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; +} + +/** Optional parameters. */ +export interface BackupInstancesValidateForRestoreOptionalParams + 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 validateForRestore operation. */ +export type BackupInstancesValidateForRestoreResponse = OperationJobExtendedInfo; + +/** Optional parameters. */ +export interface BackupInstancesListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type BackupInstancesListNextResponse = BackupInstanceResourceList; + +/** Optional parameters. */ +export interface BackupInstancesExtensionRoutingListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type BackupInstancesExtensionRoutingListResponse = BackupInstanceResourceList; + +/** Optional parameters. */ +export interface BackupInstancesExtensionRoutingListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type BackupInstancesExtensionRoutingListNextResponse = BackupInstanceResourceList; + +/** Optional parameters. */ +export interface RecoveryPointsListOptionalParams + extends coreClient.OperationOptions { + /** OData filter options. */ + filter?: string; + /** skipToken Filter. */ + skipToken?: string; +} + +/** Contains response data for the list operation. */ +export type RecoveryPointsListResponse = AzureBackupRecoveryPointResourceList; + +/** Optional parameters. */ +export interface RecoveryPointsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type RecoveryPointsGetResponse = AzureBackupRecoveryPointResource; + +/** Optional parameters. */ +export interface RecoveryPointsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type RecoveryPointsListNextResponse = AzureBackupRecoveryPointResourceList; + +/** Optional parameters. */ +export interface JobsListOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type JobsListResponse = AzureBackupJobResourceList; + +/** Optional parameters. */ +export interface JobsGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type JobsGetResponse = AzureBackupJobResource; + +/** Optional parameters. */ +export interface JobsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type JobsListNextResponse = AzureBackupJobResourceList; + +/** Optional parameters. */ +export interface RestorableTimeRangesFindOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the find operation. */ +export type RestorableTimeRangesFindResponse = AzureBackupFindRestorableTimeRangesResponseResource; + +/** Optional parameters. */ +export interface ExportJobsTriggerOptionalParams + 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 trigger operation. */ +export type ExportJobsTriggerResponse = ExportJobsTriggerHeaders; + +/** Optional parameters. */ +export interface ExportJobsOperationResultGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ExportJobsOperationResultGetResponse = ExportJobsResult; + +/** Optional parameters. */ +export interface DeletedBackupInstancesListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type DeletedBackupInstancesListResponse = DeletedBackupInstanceResourceList; + +/** Optional parameters. */ +export interface DeletedBackupInstancesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type DeletedBackupInstancesGetResponse = DeletedBackupInstanceResource; + +/** Optional parameters. */ +export interface DeletedBackupInstancesUndeleteOptionalParams + 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; +} + +/** Optional parameters. */ +export interface DeletedBackupInstancesListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type DeletedBackupInstancesListNextResponse = DeletedBackupInstanceResourceList; + +/** Optional parameters. */ +export interface ResourceGuardsGetResourcesInSubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getResourcesInSubscription operation. */ +export type ResourceGuardsGetResourcesInSubscriptionResponse = ResourceGuardResourceList; + +/** Optional parameters. */ +export interface ResourceGuardsGetResourcesInResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getResourcesInResourceGroup operation. */ +export type ResourceGuardsGetResourcesInResourceGroupResponse = ResourceGuardResourceList; + +/** Optional parameters. */ +export interface ResourceGuardsPutOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the put operation. */ +export type ResourceGuardsPutResponse = ResourceGuardResource; + +/** Optional parameters. */ +export interface ResourceGuardsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ResourceGuardsGetResponse = ResourceGuardResource; + +/** Optional parameters. */ +export interface ResourceGuardsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface ResourceGuardsPatchOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the patch operation. */ +export type ResourceGuardsPatchResponse = ResourceGuardResource; + +/** Optional parameters. */ +export interface ResourceGuardsGetDisableSoftDeleteRequestsObjectsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDisableSoftDeleteRequestsObjects operation. */ +export type ResourceGuardsGetDisableSoftDeleteRequestsObjectsResponse = DppBaseResourceList; + +/** Optional parameters. */ +export interface ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDeleteResourceGuardProxyRequestsObjects operation. */ +export type ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsResponse = DppBaseResourceList; + +/** Optional parameters. */ +export interface ResourceGuardsGetBackupSecurityPINRequestsObjectsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getBackupSecurityPINRequestsObjects operation. */ +export type ResourceGuardsGetBackupSecurityPINRequestsObjectsResponse = DppBaseResourceList; + +/** Optional parameters. */ +export interface ResourceGuardsGetDeleteProtectedItemRequestsObjectsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDeleteProtectedItemRequestsObjects operation. */ +export type ResourceGuardsGetDeleteProtectedItemRequestsObjectsResponse = DppBaseResourceList; + +/** Optional parameters. */ +export interface ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getUpdateProtectionPolicyRequestsObjects operation. */ +export type ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsResponse = DppBaseResourceList; + +/** Optional parameters. */ +export interface ResourceGuardsGetUpdateProtectedItemRequestsObjectsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getUpdateProtectedItemRequestsObjects operation. */ +export type ResourceGuardsGetUpdateProtectedItemRequestsObjectsResponse = DppBaseResourceList; + +/** Optional parameters. */ +export interface ResourceGuardsGetDefaultDisableSoftDeleteRequestsObjectOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDefaultDisableSoftDeleteRequestsObject operation. */ +export type ResourceGuardsGetDefaultDisableSoftDeleteRequestsObjectResponse = DppBaseResource; + +/** Optional parameters. */ +export interface ResourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDefaultDeleteResourceGuardProxyRequestsObject operation. */ +export type ResourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectResponse = DppBaseResource; + +/** Optional parameters. */ +export interface ResourceGuardsGetDefaultBackupSecurityPINRequestsObjectOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDefaultBackupSecurityPINRequestsObject operation. */ +export type ResourceGuardsGetDefaultBackupSecurityPINRequestsObjectResponse = DppBaseResource; + +/** Optional parameters. */ +export interface ResourceGuardsGetDefaultDeleteProtectedItemRequestsObjectOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDefaultDeleteProtectedItemRequestsObject operation. */ +export type ResourceGuardsGetDefaultDeleteProtectedItemRequestsObjectResponse = DppBaseResource; + +/** Optional parameters. */ +export interface ResourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDefaultUpdateProtectionPolicyRequestsObject operation. */ +export type ResourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectResponse = DppBaseResource; + +/** Optional parameters. */ +export interface ResourceGuardsGetDefaultUpdateProtectedItemRequestsObjectOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDefaultUpdateProtectedItemRequestsObject operation. */ +export type ResourceGuardsGetDefaultUpdateProtectedItemRequestsObjectResponse = DppBaseResource; + +/** Optional parameters. */ +export interface ResourceGuardsGetResourcesInSubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getResourcesInSubscriptionNext operation. */ +export type ResourceGuardsGetResourcesInSubscriptionNextResponse = ResourceGuardResourceList; + +/** Optional parameters. */ +export interface ResourceGuardsGetResourcesInResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getResourcesInResourceGroupNext operation. */ +export type ResourceGuardsGetResourcesInResourceGroupNextResponse = ResourceGuardResourceList; + +/** Optional parameters. */ +export interface ResourceGuardsGetDisableSoftDeleteRequestsObjectsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDisableSoftDeleteRequestsObjectsNext operation. */ +export type ResourceGuardsGetDisableSoftDeleteRequestsObjectsNextResponse = DppBaseResourceList; + +/** Optional parameters. */ +export interface ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDeleteResourceGuardProxyRequestsObjectsNext operation. */ +export type ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsNextResponse = DppBaseResourceList; + +/** Optional parameters. */ +export interface ResourceGuardsGetBackupSecurityPINRequestsObjectsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getBackupSecurityPINRequestsObjectsNext operation. */ +export type ResourceGuardsGetBackupSecurityPINRequestsObjectsNextResponse = DppBaseResourceList; + +/** Optional parameters. */ +export interface ResourceGuardsGetDeleteProtectedItemRequestsObjectsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDeleteProtectedItemRequestsObjectsNext operation. */ +export type ResourceGuardsGetDeleteProtectedItemRequestsObjectsNextResponse = DppBaseResourceList; + +/** Optional parameters. */ +export interface ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getUpdateProtectionPolicyRequestsObjectsNext operation. */ +export type ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsNextResponse = DppBaseResourceList; + +/** Optional parameters. */ +export interface ResourceGuardsGetUpdateProtectedItemRequestsObjectsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getUpdateProtectedItemRequestsObjectsNext operation. */ +export type ResourceGuardsGetUpdateProtectedItemRequestsObjectsNextResponse = DppBaseResourceList; + +/** Optional parameters. */ +export interface DppResourceGuardProxyListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type DppResourceGuardProxyListResponse = ResourceGuardProxyBaseResourceList; + +/** Optional parameters. */ +export interface DppResourceGuardProxyGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type DppResourceGuardProxyGetResponse = ResourceGuardProxyBaseResource; + +/** Optional parameters. */ +export interface DppResourceGuardProxyPutOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the put operation. */ +export type DppResourceGuardProxyPutResponse = ResourceGuardProxyBaseResource; + +/** Optional parameters. */ +export interface DppResourceGuardProxyDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface DppResourceGuardProxyUnlockDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the unlockDelete operation. */ +export type DppResourceGuardProxyUnlockDeleteResponse = UnlockDeleteResponse; + +/** Optional parameters. */ +export interface DppResourceGuardProxyListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type DppResourceGuardProxyListNextResponse = ResourceGuardProxyBaseResourceList; + +/** Optional parameters. */ +export interface DataProtectionClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/models/mappers.ts b/sdk/dataprotection/arm-dataprotection/src/models/mappers.ts new file mode 100644 index 000000000000..11d0850e4a43 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/models/mappers.ts @@ -0,0 +1,4839 @@ +/* + * 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 * as coreClient from "@azure/core-client"; + +export const BackupVault: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupVault", + modelProperties: { + monitoringSettings: { + serializedName: "monitoringSettings", + type: { + name: "Composite", + className: "MonitoringSettings" + } + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + resourceMoveState: { + serializedName: "resourceMoveState", + readOnly: true, + type: { + name: "String" + } + }, + resourceMoveDetails: { + serializedName: "resourceMoveDetails", + type: { + name: "Composite", + className: "ResourceMoveDetails" + } + }, + securitySettings: { + serializedName: "securitySettings", + type: { + name: "Composite", + className: "SecuritySettings" + } + }, + storageSettings: { + serializedName: "storageSettings", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StorageSetting" + } + } + } + }, + isVaultProtectedByResourceGuard: { + serializedName: "isVaultProtectedByResourceGuard", + readOnly: true, + type: { + name: "Boolean" + } + } + } + } +}; + +export const MonitoringSettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MonitoringSettings", + modelProperties: { + azureMonitorAlertSettings: { + serializedName: "azureMonitorAlertSettings", + type: { + name: "Composite", + className: "AzureMonitorAlertSettings" + } + } + } + } +}; + +export const AzureMonitorAlertSettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureMonitorAlertSettings", + modelProperties: { + alertsForAllJobFailures: { + serializedName: "alertsForAllJobFailures", + type: { + name: "String" + } + } + } + } +}; + +export const ResourceMoveDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceMoveDetails", + modelProperties: { + operationId: { + serializedName: "operationId", + type: { + name: "String" + } + }, + startTimeUtc: { + serializedName: "startTimeUtc", + type: { + name: "String" + } + }, + completionTimeUtc: { + serializedName: "completionTimeUtc", + type: { + name: "String" + } + }, + sourceResourcePath: { + serializedName: "sourceResourcePath", + type: { + name: "String" + } + }, + targetResourcePath: { + serializedName: "targetResourcePath", + type: { + name: "String" + } + } + } + } +}; + +export const SecuritySettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SecuritySettings", + modelProperties: { + softDeleteSettings: { + serializedName: "softDeleteSettings", + type: { + name: "Composite", + className: "SoftDeleteSettings" + } + }, + immutabilitySettings: { + serializedName: "immutabilitySettings", + type: { + name: "Composite", + className: "ImmutabilitySettings" + } + } + } + } +}; + +export const SoftDeleteSettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SoftDeleteSettings", + modelProperties: { + state: { + serializedName: "state", + type: { + name: "String" + } + }, + retentionDurationInDays: { + serializedName: "retentionDurationInDays", + type: { + name: "Number" + } + } + } + } +}; + +export const ImmutabilitySettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ImmutabilitySettings", + modelProperties: { + state: { + serializedName: "state", + type: { + name: "String" + } + } + } + } +}; + +export const StorageSetting: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageSetting", + modelProperties: { + datastoreType: { + serializedName: "datastoreType", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const DppTrackedResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DppTrackedResource", + modelProperties: { + eTag: { + serializedName: "eTag", + type: { + name: "String" + } + }, + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "DppIdentityDetails" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const DppIdentityDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DppIdentityDetails", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "String" + } + }, + tenantId: { + serializedName: "tenantId", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const DppResourceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DppResourceList", + modelProperties: { + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const CloudError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudError", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorModel" + } + } + } + } +}; + +export const ErrorModel: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorModel", + modelProperties: { + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + }, + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorModel" + } + } + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const OperationExtendedInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationExtendedInfo", + uberParent: "OperationExtendedInfo", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const OperationResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationResource", + modelProperties: { + endTime: { + serializedName: "endTime", + type: { + name: "DateTime" + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorModel" + } + }, + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "OperationExtendedInfo" + } + }, + startTime: { + serializedName: "startTime", + type: { + name: "DateTime" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + } + } + } +}; + +export const PatchResourceRequestInput: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PatchResourceRequestInput", + modelProperties: { + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "DppIdentityDetails" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "PatchBackupVaultInput" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const PatchBackupVaultInput: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PatchBackupVaultInput", + modelProperties: { + monitoringSettings: { + serializedName: "monitoringSettings", + type: { + name: "Composite", + className: "MonitoringSettings" + } + }, + securitySettings: { + serializedName: "securitySettings", + type: { + name: "Composite", + className: "SecuritySettings" + } + } + } + } +}; + +export const CheckNameAvailabilityRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckNameAvailabilityRequest", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const CheckNameAvailabilityResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckNameAvailabilityResult", + modelProperties: { + message: { + serializedName: "message", + type: { + name: "String" + } + }, + nameAvailable: { + serializedName: "nameAvailable", + type: { + name: "Boolean" + } + }, + reason: { + serializedName: "reason", + type: { + name: "String" + } + } + } + } +}; + +export const FeatureValidationRequestBase: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FeatureValidationRequestBase", + uberParent: "FeatureValidationRequestBase", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const FeatureValidationResponseBase: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FeatureValidationResponseBase", + uberParent: "FeatureValidationResponseBase", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ClientDiscoveryResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClientDiscoveryResponse", + modelProperties: { + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ClientDiscoveryValueForSingleApi" + } + } + } + } + } + } +}; + +export const ClientDiscoveryValueForSingleApi: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClientDiscoveryValueForSingleApi", + modelProperties: { + display: { + serializedName: "display", + type: { + name: "Composite", + className: "ClientDiscoveryDisplay" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + isDataAction: { + serializedName: "isDataAction", + type: { + name: "Boolean" + } + }, + origin: { + serializedName: "origin", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ClientDiscoveryForProperties" + } + } + } + } +}; + +export const ClientDiscoveryDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClientDiscoveryDisplay", + modelProperties: { + description: { + serializedName: "description", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + type: { + name: "String" + } + } + } + } +}; + +export const ClientDiscoveryForProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClientDiscoveryForProperties", + modelProperties: { + serviceSpecification: { + serializedName: "serviceSpecification", + type: { + name: "Composite", + className: "ClientDiscoveryForServiceSpecification" + } + } + } + } +}; + +export const ClientDiscoveryForServiceSpecification: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClientDiscoveryForServiceSpecification", + modelProperties: { + logSpecifications: { + serializedName: "logSpecifications", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ClientDiscoveryForLogSpecification" + } + } + } + } + } + } +}; + +export const ClientDiscoveryForLogSpecification: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClientDiscoveryForLogSpecification", + modelProperties: { + blobDuration: { + serializedName: "blobDuration", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + } + } + } +}; + +export const BaseBackupPolicy: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BaseBackupPolicy", + uberParent: "BaseBackupPolicy", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + datasourceTypes: { + serializedName: "datasourceTypes", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const DppResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DppResource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const BackupInstance: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupInstance", + modelProperties: { + friendlyName: { + serializedName: "friendlyName", + type: { + name: "String" + } + }, + dataSourceInfo: { + serializedName: "dataSourceInfo", + type: { + name: "Composite", + className: "Datasource" + } + }, + dataSourceSetInfo: { + serializedName: "dataSourceSetInfo", + type: { + name: "Composite", + className: "DatasourceSet" + } + }, + policyInfo: { + serializedName: "policyInfo", + type: { + name: "Composite", + className: "PolicyInfo" + } + }, + protectionStatus: { + serializedName: "protectionStatus", + type: { + name: "Composite", + className: "ProtectionStatusDetails" + } + }, + currentProtectionState: { + serializedName: "currentProtectionState", + readOnly: true, + type: { + name: "String" + } + }, + protectionErrorDetails: { + serializedName: "protectionErrorDetails", + type: { + name: "Composite", + className: "UserFacingError" + } + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + datasourceAuthCredentials: { + serializedName: "datasourceAuthCredentials", + type: { + name: "Composite", + className: "AuthCredentials" + } + }, + validationType: { + serializedName: "validationType", + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const Datasource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Datasource", + modelProperties: { + datasourceType: { + serializedName: "datasourceType", + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + type: { + name: "String" + } + }, + resourceID: { + serializedName: "resourceID", + required: true, + type: { + name: "String" + } + }, + resourceLocation: { + serializedName: "resourceLocation", + type: { + name: "String" + } + }, + resourceName: { + serializedName: "resourceName", + type: { + name: "String" + } + }, + resourceType: { + serializedName: "resourceType", + type: { + name: "String" + } + }, + resourceUri: { + serializedName: "resourceUri", + type: { + name: "String" + } + } + } + } +}; + +export const DatasourceSet: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DatasourceSet", + modelProperties: { + datasourceType: { + serializedName: "datasourceType", + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + type: { + name: "String" + } + }, + resourceID: { + serializedName: "resourceID", + required: true, + type: { + name: "String" + } + }, + resourceLocation: { + serializedName: "resourceLocation", + type: { + name: "String" + } + }, + resourceName: { + serializedName: "resourceName", + type: { + name: "String" + } + }, + resourceType: { + serializedName: "resourceType", + type: { + name: "String" + } + }, + resourceUri: { + serializedName: "resourceUri", + type: { + name: "String" + } + } + } + } +}; + +export const PolicyInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PolicyInfo", + modelProperties: { + policyId: { + serializedName: "policyId", + required: true, + type: { + name: "String" + } + }, + policyVersion: { + serializedName: "policyVersion", + readOnly: true, + type: { + name: "String" + } + }, + policyParameters: { + serializedName: "policyParameters", + type: { + name: "Composite", + className: "PolicyParameters" + } + } + } + } +}; + +export const PolicyParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PolicyParameters", + modelProperties: { + dataStoreParametersList: { + serializedName: "dataStoreParametersList", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DataStoreParameters" + } + } + } + }, + backupDatasourceParametersList: { + serializedName: "backupDatasourceParametersList", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "BackupDatasourceParameters" + } + } + } + } + } + } +}; + +export const DataStoreParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DataStoreParameters", + uberParent: "DataStoreParameters", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + }, + dataStoreType: { + serializedName: "dataStoreType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const BackupDatasourceParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupDatasourceParameters", + uberParent: "BackupDatasourceParameters", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ProtectionStatusDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProtectionStatusDetails", + modelProperties: { + errorDetails: { + serializedName: "errorDetails", + type: { + name: "Composite", + className: "UserFacingError" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + } + } + } +}; + +export const UserFacingError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UserFacingError", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + details: { + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "UserFacingError" + } + } + } + }, + innerError: { + serializedName: "innerError", + type: { + name: "Composite", + className: "InnerError" + } + }, + isRetryable: { + serializedName: "isRetryable", + type: { + name: "Boolean" + } + }, + isUserError: { + serializedName: "isUserError", + type: { + name: "Boolean" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + }, + recommendedAction: { + serializedName: "recommendedAction", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + target: { + serializedName: "target", + type: { + name: "String" + } + } + } + } +}; + +export const InnerError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "InnerError", + modelProperties: { + additionalInfo: { + serializedName: "additionalInfo", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + code: { + serializedName: "code", + type: { + name: "String" + } + }, + embeddedInnerError: { + serializedName: "embeddedInnerError", + type: { + name: "Composite", + className: "InnerError" + } + } + } + } +}; + +export const AuthCredentials: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AuthCredentials", + uberParent: "AuthCredentials", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const DppProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DppProxyResource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const TriggerBackupRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TriggerBackupRequest", + modelProperties: { + backupRuleOptions: { + serializedName: "backupRuleOptions", + type: { + name: "Composite", + className: "AdHocBackupRuleOptions" + } + } + } + } +}; + +export const AdHocBackupRuleOptions: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AdHocBackupRuleOptions", + modelProperties: { + ruleName: { + serializedName: "ruleName", + required: true, + type: { + name: "String" + } + }, + triggerOption: { + serializedName: "triggerOption", + type: { + name: "Composite", + className: "AdhocBackupTriggerOption" + } + } + } + } +}; + +export const AdhocBackupTriggerOption: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AdhocBackupTriggerOption", + modelProperties: { + retentionTagOverride: { + serializedName: "retentionTagOverride", + type: { + name: "String" + } + } + } + } +}; + +export const ValidateForBackupRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ValidateForBackupRequest", + modelProperties: { + backupInstance: { + serializedName: "backupInstance", + type: { + name: "Composite", + className: "BackupInstance" + } + } + } + } +}; + +export const AzureBackupRecoveryPoint: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureBackupRecoveryPoint", + uberParent: "AzureBackupRecoveryPoint", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + objectType: { + serializedName: "objectType", + 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 AzureBackupRestoreRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureBackupRestoreRequest", + uberParent: "AzureBackupRestoreRequest", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + }, + restoreTargetInfo: { + serializedName: "restoreTargetInfo", + type: { + name: "Composite", + className: "RestoreTargetInfoBase" + } + }, + sourceDataStoreType: { + serializedName: "sourceDataStoreType", + required: true, + type: { + name: "String" + } + }, + sourceResourceId: { + serializedName: "sourceResourceId", + type: { + name: "String" + } + } + } + } +}; + +export const RestoreTargetInfoBase: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RestoreTargetInfoBase", + uberParent: "RestoreTargetInfoBase", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + }, + recoveryOption: { + serializedName: "recoveryOption", + required: true, + type: { + name: "String" + } + }, + restoreLocation: { + serializedName: "restoreLocation", + 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 AzureBackupJob: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureBackupJob", + modelProperties: { + activityID: { + serializedName: "activityID", + required: true, + type: { + name: "String" + } + }, + backupInstanceFriendlyName: { + serializedName: "backupInstanceFriendlyName", + required: true, + type: { + name: "String" + } + }, + backupInstanceId: { + serializedName: "backupInstanceId", + readOnly: true, + type: { + name: "String" + } + }, + dataSourceId: { + serializedName: "dataSourceId", + required: true, + type: { + name: "String" + } + }, + dataSourceLocation: { + serializedName: "dataSourceLocation", + required: true, + type: { + name: "String" + } + }, + dataSourceName: { + serializedName: "dataSourceName", + required: true, + type: { + name: "String" + } + }, + dataSourceSetName: { + serializedName: "dataSourceSetName", + type: { + name: "String" + } + }, + dataSourceType: { + serializedName: "dataSourceType", + required: true, + type: { + name: "String" + } + }, + duration: { + serializedName: "duration", + type: { + name: "String" + } + }, + endTime: { + serializedName: "endTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + errorDetails: { + serializedName: "errorDetails", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "UserFacingError" + } + } + } + }, + extendedInfo: { + serializedName: "extendedInfo", + type: { + name: "Composite", + className: "JobExtendedInfo" + } + }, + isUserTriggered: { + serializedName: "isUserTriggered", + required: true, + type: { + name: "Boolean" + } + }, + operation: { + serializedName: "operation", + required: true, + type: { + name: "String" + } + }, + operationCategory: { + serializedName: "operationCategory", + required: true, + type: { + name: "String" + } + }, + policyId: { + serializedName: "policyId", + readOnly: true, + type: { + name: "String" + } + }, + policyName: { + serializedName: "policyName", + readOnly: true, + type: { + name: "String" + } + }, + progressEnabled: { + serializedName: "progressEnabled", + required: true, + type: { + name: "Boolean" + } + }, + progressUrl: { + serializedName: "progressUrl", + readOnly: true, + type: { + name: "String" + } + }, + restoreType: { + serializedName: "restoreType", + readOnly: true, + type: { + name: "String" + } + }, + sourceResourceGroup: { + serializedName: "sourceResourceGroup", + required: true, + type: { + name: "String" + } + }, + sourceSubscriptionID: { + serializedName: "sourceSubscriptionID", + required: true, + type: { + name: "String" + } + }, + startTime: { + serializedName: "startTime", + required: true, + type: { + name: "DateTime" + } + }, + status: { + serializedName: "status", + required: true, + type: { + name: "String" + } + }, + subscriptionId: { + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + }, + supportedActions: { + serializedName: "supportedActions", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + vaultName: { + serializedName: "vaultName", + required: true, + type: { + name: "String" + } + }, + etag: { + serializedName: "etag", + type: { + name: "String" + } + }, + sourceDataStoreName: { + serializedName: "sourceDataStoreName", + type: { + name: "String" + } + }, + destinationDataStoreName: { + serializedName: "destinationDataStoreName", + type: { + name: "String" + } + } + } + } +}; + +export const JobExtendedInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "JobExtendedInfo", + modelProperties: { + additionalDetails: { + serializedName: "additionalDetails", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + backupInstanceState: { + serializedName: "backupInstanceState", + readOnly: true, + type: { + name: "String" + } + }, + dataTransferredInBytes: { + serializedName: "dataTransferredInBytes", + readOnly: true, + type: { + name: "Number" + } + }, + recoveryDestination: { + serializedName: "recoveryDestination", + readOnly: true, + type: { + name: "String" + } + }, + sourceRecoverPoint: { + serializedName: "sourceRecoverPoint", + type: { + name: "Composite", + className: "RestoreJobRecoveryPointDetails" + } + }, + subTasks: { + serializedName: "subTasks", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "JobSubTask" + } + } + } + }, + targetRecoverPoint: { + serializedName: "targetRecoverPoint", + type: { + name: "Composite", + className: "RestoreJobRecoveryPointDetails" + } + } + } + } +}; + +export const RestoreJobRecoveryPointDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RestoreJobRecoveryPointDetails", + modelProperties: { + recoveryPointID: { + serializedName: "recoveryPointID", + type: { + name: "String" + } + }, + recoveryPointTime: { + serializedName: "recoveryPointTime", + type: { + name: "DateTime" + } + } + } + } +}; + +export const JobSubTask: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "JobSubTask", + modelProperties: { + additionalDetails: { + serializedName: "additionalDetails", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + taskId: { + serializedName: "taskId", + required: true, + type: { + name: "Number" + } + }, + taskName: { + serializedName: "taskName", + required: true, + type: { + name: "String" + } + }, + taskProgress: { + serializedName: "taskProgress", + readOnly: true, + type: { + name: "String" + } + }, + taskStatus: { + serializedName: "taskStatus", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const AzureBackupFindRestorableTimeRangesRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureBackupFindRestorableTimeRangesRequest", + modelProperties: { + sourceDataStoreType: { + serializedName: "sourceDataStoreType", + required: true, + type: { + name: "String" + } + }, + startTime: { + serializedName: "startTime", + type: { + name: "String" + } + }, + endTime: { + serializedName: "endTime", + type: { + name: "String" + } + } + } + } +}; + +export const AzureBackupFindRestorableTimeRangesResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureBackupFindRestorableTimeRangesResponse", + modelProperties: { + restorableTimeRanges: { + serializedName: "restorableTimeRanges", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "RestorableTimeRange" + } + } + } + }, + objectType: { + serializedName: "objectType", + type: { + name: "String" + } + } + } + } +}; + +export const RestorableTimeRange: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RestorableTimeRange", + modelProperties: { + startTime: { + serializedName: "startTime", + required: true, + type: { + name: "String" + } + }, + endTime: { + serializedName: "endTime", + required: true, + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + type: { + name: "String" + } + } + } + } +}; + +export const ExportJobsResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExportJobsResult", + modelProperties: { + blobUrl: { + serializedName: "blobUrl", + readOnly: true, + type: { + name: "String" + } + }, + blobSasKey: { + serializedName: "blobSasKey", + readOnly: true, + type: { + name: "String" + } + }, + excelFileBlobUrl: { + serializedName: "excelFileBlobUrl", + readOnly: true, + type: { + name: "String" + } + }, + excelFileBlobSasKey: { + serializedName: "excelFileBlobSasKey", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DeletionInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeletionInfo", + modelProperties: { + deletionTime: { + serializedName: "deletionTime", + readOnly: true, + type: { + name: "String" + } + }, + billingEndDate: { + serializedName: "billingEndDate", + readOnly: true, + type: { + name: "String" + } + }, + scheduledPurgeTime: { + serializedName: "scheduledPurgeTime", + readOnly: true, + type: { + name: "String" + } + }, + deleteActivityID: { + serializedName: "deleteActivityID", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ResourceGuard: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceGuard", + modelProperties: { + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + allowAutoApprovals: { + serializedName: "allowAutoApprovals", + readOnly: true, + type: { + name: "Boolean" + } + }, + resourceGuardOperations: { + serializedName: "resourceGuardOperations", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceGuardOperation" + } + } + } + }, + vaultCriticalOperationExclusionList: { + serializedName: "vaultCriticalOperationExclusionList", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ResourceGuardOperation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceGuardOperation", + modelProperties: { + vaultCriticalOperation: { + serializedName: "vaultCriticalOperation", + readOnly: true, + type: { + name: "String" + } + }, + requestResourceType: { + serializedName: "requestResourceType", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DppTrackedResourceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DppTrackedResourceList", + modelProperties: { + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const DppBaseResourceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DppBaseResourceList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DppBaseResource" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const DppBaseResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DppBaseResource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ResourceGuardProxyBase: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceGuardProxyBase", + modelProperties: { + resourceGuardResourceId: { + serializedName: "resourceGuardResourceId", + type: { + name: "String" + } + }, + resourceGuardOperationDetails: { + serializedName: "resourceGuardOperationDetails", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceGuardOperationDetail" + } + } + } + }, + lastUpdatedTime: { + serializedName: "lastUpdatedTime", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const ResourceGuardOperationDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceGuardOperationDetail", + modelProperties: { + vaultCriticalOperation: { + serializedName: "vaultCriticalOperation", + type: { + name: "String" + } + }, + defaultResourceRequest: { + serializedName: "defaultResourceRequest", + type: { + name: "String" + } + } + } + } +}; + +export const UnlockDeleteRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UnlockDeleteRequest", + modelProperties: { + resourceGuardOperationRequests: { + serializedName: "resourceGuardOperationRequests", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + resourceToBeDeleted: { + serializedName: "resourceToBeDeleted", + type: { + name: "String" + } + } + } + } +}; + +export const UnlockDeleteResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UnlockDeleteResponse", + modelProperties: { + unlockDeleteExpiryTime: { + serializedName: "unlockDeleteExpiryTime", + type: { + name: "String" + } + } + } + } +}; + +export const DeleteOption: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeleteOption", + uberParent: "DeleteOption", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + duration: { + serializedName: "duration", + required: true, + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const RecoveryPointsFilters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RecoveryPointsFilters", + modelProperties: { + restorePointDataStoreId: { + serializedName: "restorePointDataStoreId", + type: { + name: "String" + } + }, + isVisible: { + serializedName: "isVisible", + type: { + name: "Boolean" + } + }, + startDate: { + serializedName: "startDate", + type: { + name: "String" + } + }, + endDate: { + serializedName: "endDate", + type: { + name: "String" + } + }, + extendedInfo: { + serializedName: "extendedInfo", + type: { + name: "Boolean" + } + }, + restorePointState: { + serializedName: "restorePointState", + type: { + name: "String" + } + } + } + } +}; + +export const AdhocBasedTaggingCriteria: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AdhocBasedTaggingCriteria", + modelProperties: { + tagInfo: { + serializedName: "tagInfo", + type: { + name: "Composite", + className: "RetentionTag" + } + } + } + } +}; + +export const RetentionTag: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RetentionTag", + modelProperties: { + eTag: { + serializedName: "eTag", + readOnly: true, + type: { + name: "String" + } + }, + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + tagName: { + serializedName: "tagName", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const TriggerContext: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TriggerContext", + uberParent: "TriggerContext", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const RecoveryPointDataStoreDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RecoveryPointDataStoreDetails", + modelProperties: { + creationTime: { + serializedName: "creationTime", + type: { + name: "DateTime" + } + }, + expiryTime: { + serializedName: "expiryTime", + type: { + name: "DateTime" + } + }, + id: { + serializedName: "id", + type: { + name: "String" + } + }, + metaData: { + serializedName: "metaData", + type: { + name: "String" + } + }, + state: { + serializedName: "state", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + visible: { + serializedName: "visible", + type: { + name: "Boolean" + } + }, + rehydrationExpiryTime: { + serializedName: "rehydrationExpiryTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + rehydrationStatus: { + serializedName: "rehydrationStatus", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DppWorkerRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DppWorkerRequest", + modelProperties: { + subscriptionId: { + serializedName: "subscriptionId", + type: { + name: "String" + } + }, + uri: { + serializedName: "uri", + type: { + name: "String" + } + }, + headers: { + serializedName: "headers", + type: { + name: "Dictionary", + value: { + type: { name: "Sequence", element: { type: { name: "String" } } } + } + } + }, + supportedGroupVersions: { + serializedName: "supportedGroupVersions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + cultureInfo: { + serializedName: "cultureInfo", + type: { + name: "String" + } + }, + parameters: { + serializedName: "parameters", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + httpMethod: { + serializedName: "httpMethod", + type: { + name: "String" + } + } + } + } +}; + +export const BackupParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupParameters", + uberParent: "BackupParameters", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const DataStoreInfoBase: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DataStoreInfoBase", + modelProperties: { + dataStoreType: { + serializedName: "dataStoreType", + required: true, + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const BasePolicyRule: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BasePolicyRule", + uberParent: "BasePolicyRule", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + }, + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const SourceLifeCycle: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SourceLifeCycle", + modelProperties: { + deleteAfter: { + serializedName: "deleteAfter", + type: { + name: "Composite", + className: "DeleteOption" + } + }, + sourceDataStore: { + serializedName: "sourceDataStore", + type: { + name: "Composite", + className: "DataStoreInfoBase" + } + }, + targetDataStoreCopySettings: { + serializedName: "targetDataStoreCopySettings", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "TargetCopySetting" + } + } + } + } + } + } +}; + +export const TargetCopySetting: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TargetCopySetting", + modelProperties: { + copyAfter: { + serializedName: "copyAfter", + type: { + name: "Composite", + className: "CopyOption" + } + }, + dataStore: { + serializedName: "dataStore", + type: { + name: "Composite", + className: "DataStoreInfoBase" + } + } + } + } +}; + +export const CopyOption: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CopyOption", + uberParent: "CopyOption", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const BackupCriteria: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupCriteria", + uberParent: "BackupCriteria", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const BackupSchedule: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupSchedule", + modelProperties: { + repeatingTimeIntervals: { + serializedName: "repeatingTimeIntervals", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + timeZone: { + serializedName: "timeZone", + type: { + name: "String" + } + } + } + } +}; + +export const Day: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Day", + modelProperties: { + date: { + serializedName: "date", + type: { + name: "Number" + } + }, + isLast: { + serializedName: "isLast", + type: { + name: "Boolean" + } + } + } + } +}; + +export const SupportedFeature: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SupportedFeature", + modelProperties: { + featureName: { + serializedName: "featureName", + type: { + name: "String" + } + }, + supportStatus: { + serializedName: "supportStatus", + type: { + name: "String" + } + }, + exposureControlledFeatures: { + serializedName: "exposureControlledFeatures", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const ItemLevelRestoreCriteria: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ItemLevelRestoreCriteria", + uberParent: "ItemLevelRestoreCriteria", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + objectType: { + serializedName: "objectType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const TargetDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TargetDetails", + modelProperties: { + filePrefix: { + serializedName: "filePrefix", + required: true, + type: { + name: "String" + } + }, + restoreTargetLocationType: { + serializedName: "restoreTargetLocationType", + required: true, + type: { + name: "String" + } + }, + url: { + serializedName: "url", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const TaggingCriteria: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TaggingCriteria", + modelProperties: { + criteria: { + serializedName: "criteria", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "BackupCriteria" + } + } + } + }, + isDefault: { + serializedName: "isDefault", + required: true, + type: { + name: "Boolean" + } + }, + taggingPriority: { + serializedName: "taggingPriority", + required: true, + type: { + name: "Number" + } + }, + tagInfo: { + serializedName: "tagInfo", + type: { + name: "Composite", + className: "RetentionTag" + } + } + } + } +}; + +export const SecretStoreResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SecretStoreResource", + modelProperties: { + uri: { + serializedName: "uri", + type: { + name: "String" + } + }, + secretStoreType: { + serializedName: "secretStoreType", + required: true, + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + } + } + } +}; + +export const BackupVaultResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupVaultResource", + modelProperties: { + ...DppTrackedResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "BackupVault" + } + } + } + } +}; + +export const ResourceGuardResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceGuardResource", + modelProperties: { + ...DppTrackedResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ResourceGuard" + } + } + } + } +}; + +export const BackupVaultResourceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupVaultResourceList", + modelProperties: { + ...DppResourceList.type.modelProperties, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "BackupVaultResource" + } + } + } + } + } + } +}; + +export const BaseBackupPolicyResourceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BaseBackupPolicyResourceList", + modelProperties: { + ...DppResourceList.type.modelProperties, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "BaseBackupPolicyResource" + } + } + } + } + } + } +}; + +export const BackupInstanceResourceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupInstanceResourceList", + modelProperties: { + ...DppResourceList.type.modelProperties, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "BackupInstanceResource" + } + } + } + } + } + } +}; + +export const AzureBackupRecoveryPointResourceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureBackupRecoveryPointResourceList", + modelProperties: { + ...DppResourceList.type.modelProperties, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AzureBackupRecoveryPointResource" + } + } + } + } + } + } +}; + +export const AzureBackupJobResourceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureBackupJobResourceList", + modelProperties: { + ...DppResourceList.type.modelProperties, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AzureBackupJobResource" + } + } + } + } + } + } +}; + +export const DeletedBackupInstanceResourceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeletedBackupInstanceResourceList", + modelProperties: { + ...DppResourceList.type.modelProperties, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DeletedBackupInstanceResource" + } + } + } + } + } + } +}; + +export const ResourceGuardProxyBaseResourceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceGuardProxyBaseResourceList", + modelProperties: { + ...DppResourceList.type.modelProperties, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceGuardProxyBaseResource" + } + } + } + } + } + } +}; + +export const OperationJobExtendedInfo: coreClient.CompositeMapper = { + serializedName: "OperationJobExtendedInfo", + type: { + name: "Composite", + className: "OperationJobExtendedInfo", + uberParent: "OperationExtendedInfo", + polymorphicDiscriminator: + OperationExtendedInfo.type.polymorphicDiscriminator, + modelProperties: { + ...OperationExtendedInfo.type.modelProperties, + jobId: { + serializedName: "jobId", + type: { + name: "String" + } + } + } + } +}; + +export const FeatureValidationRequest: coreClient.CompositeMapper = { + serializedName: "FeatureValidationRequest", + type: { + name: "Composite", + className: "FeatureValidationRequest", + uberParent: "FeatureValidationRequestBase", + modelProperties: { + ...FeatureValidationRequestBase.type.modelProperties, + featureType: { + serializedName: "featureType", + type: { + name: "String" + } + }, + featureName: { + serializedName: "featureName", + type: { + name: "String" + } + } + } + } +}; +FeatureValidationRequestBase.type.polymorphicDiscriminator = + FeatureValidationRequestBase.type.polymorphicDiscriminator; + +export const FeatureValidationResponse: coreClient.CompositeMapper = { + serializedName: "FeatureValidationResponse", + type: { + name: "Composite", + className: "FeatureValidationResponse", + uberParent: "FeatureValidationResponseBase", + modelProperties: { + ...FeatureValidationResponseBase.type.modelProperties, + featureType: { + serializedName: "featureType", + type: { + name: "String" + } + }, + features: { + serializedName: "features", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SupportedFeature" + } + } + } + } + } + } +}; +FeatureValidationResponseBase.type.polymorphicDiscriminator = + FeatureValidationResponseBase.type.polymorphicDiscriminator; + +export const BackupPolicy: coreClient.CompositeMapper = { + serializedName: "BackupPolicy", + type: { + name: "Composite", + className: "BackupPolicy", + uberParent: "BaseBackupPolicy", + polymorphicDiscriminator: BaseBackupPolicy.type.polymorphicDiscriminator, + modelProperties: { + ...BaseBackupPolicy.type.modelProperties, + policyRules: { + serializedName: "policyRules", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "BasePolicyRule" + } + } + } + } + } + } +}; + +export const BaseBackupPolicyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BaseBackupPolicyResource", + modelProperties: { + ...DppResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "BaseBackupPolicy" + } + } + } + } +}; + +export const AzureBackupRecoveryPointResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureBackupRecoveryPointResource", + modelProperties: { + ...DppResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "AzureBackupRecoveryPoint" + } + } + } + } +}; + +export const AzureBackupJobResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureBackupJobResource", + modelProperties: { + ...DppResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "AzureBackupJob" + } + } + } + } +}; + +export const AzureBackupFindRestorableTimeRangesResponseResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureBackupFindRestorableTimeRangesResponseResource", + modelProperties: { + ...DppResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "AzureBackupFindRestorableTimeRangesResponse" + } + } + } + } +}; + +export const DeletedBackupInstanceResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeletedBackupInstanceResource", + modelProperties: { + ...DppResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "DeletedBackupInstance" + } + } + } + } +}; + +export const ResourceGuardProxyBaseResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceGuardProxyBaseResource", + modelProperties: { + ...DppResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ResourceGuardProxyBase" + } + } + } + } +}; + +export const DeletedBackupInstance: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeletedBackupInstance", + modelProperties: { + ...BackupInstance.type.modelProperties, + deletionInfo: { + serializedName: "deletionInfo", + type: { + name: "Composite", + className: "DeletionInfo" + } + } + } + } +}; + +export const AzureOperationalStoreParameters: coreClient.CompositeMapper = { + serializedName: "AzureOperationalStoreParameters", + type: { + name: "Composite", + className: "AzureOperationalStoreParameters", + uberParent: "DataStoreParameters", + polymorphicDiscriminator: DataStoreParameters.type.polymorphicDiscriminator, + modelProperties: { + ...DataStoreParameters.type.modelProperties, + resourceGroupId: { + serializedName: "resourceGroupId", + type: { + name: "String" + } + } + } + } +}; + +export const KubernetesClusterBackupDatasourceParameters: coreClient.CompositeMapper = { + serializedName: "KubernetesClusterBackupDatasourceParameters", + type: { + name: "Composite", + className: "KubernetesClusterBackupDatasourceParameters", + uberParent: "BackupDatasourceParameters", + polymorphicDiscriminator: + BackupDatasourceParameters.type.polymorphicDiscriminator, + modelProperties: { + ...BackupDatasourceParameters.type.modelProperties, + snapshotVolumes: { + serializedName: "snapshotVolumes", + required: true, + type: { + name: "Boolean" + } + }, + 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" + } + } + } + } + } + } +}; + +export const BlobBackupDatasourceParameters: coreClient.CompositeMapper = { + serializedName: "BlobBackupDatasourceParameters", + type: { + name: "Composite", + className: "BlobBackupDatasourceParameters", + uberParent: "BackupDatasourceParameters", + polymorphicDiscriminator: + BackupDatasourceParameters.type.polymorphicDiscriminator, + modelProperties: { + ...BackupDatasourceParameters.type.modelProperties, + containersList: { + serializedName: "containersList", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const SecretStoreBasedAuthCredentials: coreClient.CompositeMapper = { + serializedName: "SecretStoreBasedAuthCredentials", + type: { + name: "Composite", + className: "SecretStoreBasedAuthCredentials", + uberParent: "AuthCredentials", + polymorphicDiscriminator: AuthCredentials.type.polymorphicDiscriminator, + modelProperties: { + ...AuthCredentials.type.modelProperties, + secretStoreResource: { + serializedName: "secretStoreResource", + type: { + name: "Composite", + className: "SecretStoreResource" + } + } + } + } +}; + +export const BackupInstanceResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupInstanceResource", + modelProperties: { + ...DppProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "BackupInstance" + } + } + } + } +}; + +export const AzureBackupDiscreteRecoveryPoint: coreClient.CompositeMapper = { + serializedName: "AzureBackupDiscreteRecoveryPoint", + type: { + name: "Composite", + className: "AzureBackupDiscreteRecoveryPoint", + uberParent: "AzureBackupRecoveryPoint", + polymorphicDiscriminator: + AzureBackupRecoveryPoint.type.polymorphicDiscriminator, + modelProperties: { + ...AzureBackupRecoveryPoint.type.modelProperties, + friendlyName: { + serializedName: "friendlyName", + type: { + name: "String" + } + }, + recoveryPointDataStoresDetails: { + serializedName: "recoveryPointDataStoresDetails", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "RecoveryPointDataStoreDetails" + } + } + } + }, + recoveryPointTime: { + serializedName: "recoveryPointTime", + required: true, + type: { + name: "DateTime" + } + }, + policyName: { + serializedName: "policyName", + type: { + name: "String" + } + }, + policyVersion: { + serializedName: "policyVersion", + type: { + name: "String" + } + }, + recoveryPointId: { + serializedName: "recoveryPointId", + type: { + name: "String" + } + }, + recoveryPointType: { + serializedName: "recoveryPointType", + type: { + name: "String" + } + }, + retentionTagName: { + serializedName: "retentionTagName", + type: { + name: "String" + } + }, + retentionTagVersion: { + serializedName: "retentionTagVersion", + type: { + name: "String" + } + } + } + } +}; + +export const AzureBackupRecoveryPointBasedRestoreRequest: coreClient.CompositeMapper = { + serializedName: "AzureBackupRecoveryPointBasedRestoreRequest", + type: { + name: "Composite", + className: "AzureBackupRecoveryPointBasedRestoreRequest", + uberParent: "AzureBackupRestoreRequest", + polymorphicDiscriminator: { + serializedName: "objectType", + clientName: "objectType" + }, + modelProperties: { + ...AzureBackupRestoreRequest.type.modelProperties, + recoveryPointId: { + serializedName: "recoveryPointId", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const AzureBackupRecoveryTimeBasedRestoreRequest: coreClient.CompositeMapper = { + serializedName: "AzureBackupRecoveryTimeBasedRestoreRequest", + type: { + name: "Composite", + className: "AzureBackupRecoveryTimeBasedRestoreRequest", + uberParent: "AzureBackupRestoreRequest", + polymorphicDiscriminator: + AzureBackupRestoreRequest.type.polymorphicDiscriminator, + modelProperties: { + ...AzureBackupRestoreRequest.type.modelProperties, + recoveryPointTime: { + serializedName: "recoveryPointTime", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ItemLevelRestoreTargetInfo: coreClient.CompositeMapper = { + serializedName: "ItemLevelRestoreTargetInfo", + type: { + name: "Composite", + className: "ItemLevelRestoreTargetInfo", + uberParent: "RestoreTargetInfoBase", + polymorphicDiscriminator: + RestoreTargetInfoBase.type.polymorphicDiscriminator, + modelProperties: { + ...RestoreTargetInfoBase.type.modelProperties, + restoreCriteria: { + serializedName: "restoreCriteria", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ItemLevelRestoreCriteria" + } + } + } + }, + datasourceInfo: { + serializedName: "datasourceInfo", + type: { + name: "Composite", + className: "Datasource" + } + }, + datasourceSetInfo: { + serializedName: "datasourceSetInfo", + type: { + name: "Composite", + className: "DatasourceSet" + } + }, + datasourceAuthCredentials: { + serializedName: "datasourceAuthCredentials", + type: { + name: "Composite", + className: "AuthCredentials" + } + } + } + } +}; + +export const RestoreFilesTargetInfo: coreClient.CompositeMapper = { + serializedName: "RestoreFilesTargetInfo", + type: { + name: "Composite", + className: "RestoreFilesTargetInfo", + uberParent: "RestoreTargetInfoBase", + polymorphicDiscriminator: + RestoreTargetInfoBase.type.polymorphicDiscriminator, + modelProperties: { + ...RestoreTargetInfoBase.type.modelProperties, + targetDetails: { + serializedName: "targetDetails", + type: { + name: "Composite", + className: "TargetDetails" + } + } + } + } +}; + +export const RestoreTargetInfo: coreClient.CompositeMapper = { + serializedName: "RestoreTargetInfo", + type: { + name: "Composite", + className: "RestoreTargetInfo", + uberParent: "RestoreTargetInfoBase", + modelProperties: { + ...RestoreTargetInfoBase.type.modelProperties, + datasourceInfo: { + serializedName: "datasourceInfo", + type: { + name: "Composite", + className: "Datasource" + } + }, + datasourceSetInfo: { + serializedName: "datasourceSetInfo", + type: { + name: "Composite", + className: "DatasourceSet" + } + }, + datasourceAuthCredentials: { + serializedName: "datasourceAuthCredentials", + type: { + name: "Composite", + className: "AuthCredentials" + } + } + } + } +}; +RestoreTargetInfoBase.type.polymorphicDiscriminator = + RestoreTargetInfoBase.type.polymorphicDiscriminator; + +export const ResourceGuardResourceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceGuardResourceList", + modelProperties: { + ...DppTrackedResourceList.type.modelProperties, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceGuardResource" + } + } + } + } + } + } +}; + +export const AbsoluteDeleteOption: coreClient.CompositeMapper = { + serializedName: "AbsoluteDeleteOption", + type: { + name: "Composite", + className: "AbsoluteDeleteOption", + uberParent: "DeleteOption", + polymorphicDiscriminator: DeleteOption.type.polymorphicDiscriminator, + modelProperties: { + ...DeleteOption.type.modelProperties + } + } +}; + +export const AdhocBasedTriggerContext: coreClient.CompositeMapper = { + serializedName: "AdhocBasedTriggerContext", + type: { + name: "Composite", + className: "AdhocBasedTriggerContext", + uberParent: "TriggerContext", + polymorphicDiscriminator: TriggerContext.type.polymorphicDiscriminator, + modelProperties: { + ...TriggerContext.type.modelProperties, + taggingCriteria: { + serializedName: "taggingCriteria", + type: { + name: "Composite", + className: "AdhocBasedTaggingCriteria" + } + } + } + } +}; + +export const ScheduleBasedTriggerContext: coreClient.CompositeMapper = { + serializedName: "ScheduleBasedTriggerContext", + type: { + name: "Composite", + className: "ScheduleBasedTriggerContext", + uberParent: "TriggerContext", + polymorphicDiscriminator: TriggerContext.type.polymorphicDiscriminator, + modelProperties: { + ...TriggerContext.type.modelProperties, + schedule: { + serializedName: "schedule", + type: { + name: "Composite", + className: "BackupSchedule" + } + }, + taggingCriteria: { + serializedName: "taggingCriteria", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "TaggingCriteria" + } + } + } + } + } + } +}; + +export const AzureBackupFindRestorableTimeRangesRequestResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureBackupFindRestorableTimeRangesRequestResource", + modelProperties: { + ...DppWorkerRequest.type.modelProperties, + content: { + serializedName: "content", + type: { + name: "Composite", + className: "AzureBackupFindRestorableTimeRangesRequest" + } + } + } + } +}; + +export const AzureBackupParams: coreClient.CompositeMapper = { + serializedName: "AzureBackupParams", + type: { + name: "Composite", + className: "AzureBackupParams", + uberParent: "BackupParameters", + polymorphicDiscriminator: BackupParameters.type.polymorphicDiscriminator, + modelProperties: { + ...BackupParameters.type.modelProperties, + backupType: { + serializedName: "backupType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const AzureBackupRule: coreClient.CompositeMapper = { + serializedName: "AzureBackupRule", + type: { + name: "Composite", + className: "AzureBackupRule", + uberParent: "BasePolicyRule", + polymorphicDiscriminator: BasePolicyRule.type.polymorphicDiscriminator, + modelProperties: { + ...BasePolicyRule.type.modelProperties, + backupParameters: { + serializedName: "backupParameters", + type: { + name: "Composite", + className: "BackupParameters" + } + }, + dataStore: { + serializedName: "dataStore", + type: { + name: "Composite", + className: "DataStoreInfoBase" + } + }, + trigger: { + serializedName: "trigger", + type: { + name: "Composite", + className: "TriggerContext" + } + } + } + } +}; + +export const AzureRetentionRule: coreClient.CompositeMapper = { + serializedName: "AzureRetentionRule", + type: { + name: "Composite", + className: "AzureRetentionRule", + uberParent: "BasePolicyRule", + polymorphicDiscriminator: BasePolicyRule.type.polymorphicDiscriminator, + modelProperties: { + ...BasePolicyRule.type.modelProperties, + isDefault: { + serializedName: "isDefault", + type: { + name: "Boolean" + } + }, + lifecycles: { + serializedName: "lifecycles", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SourceLifeCycle" + } + } + } + } + } + } +}; + +export const CopyOnExpiryOption: coreClient.CompositeMapper = { + serializedName: "CopyOnExpiryOption", + type: { + name: "Composite", + className: "CopyOnExpiryOption", + uberParent: "CopyOption", + polymorphicDiscriminator: CopyOption.type.polymorphicDiscriminator, + modelProperties: { + ...CopyOption.type.modelProperties + } + } +}; + +export const CustomCopyOption: coreClient.CompositeMapper = { + serializedName: "CustomCopyOption", + type: { + name: "Composite", + className: "CustomCopyOption", + uberParent: "CopyOption", + polymorphicDiscriminator: CopyOption.type.polymorphicDiscriminator, + modelProperties: { + ...CopyOption.type.modelProperties, + duration: { + serializedName: "duration", + type: { + name: "String" + } + } + } + } +}; + +export const ImmediateCopyOption: coreClient.CompositeMapper = { + serializedName: "ImmediateCopyOption", + type: { + name: "Composite", + className: "ImmediateCopyOption", + uberParent: "CopyOption", + polymorphicDiscriminator: CopyOption.type.polymorphicDiscriminator, + modelProperties: { + ...CopyOption.type.modelProperties + } + } +}; + +export const ScheduleBasedBackupCriteria: coreClient.CompositeMapper = { + serializedName: "ScheduleBasedBackupCriteria", + type: { + name: "Composite", + className: "ScheduleBasedBackupCriteria", + uberParent: "BackupCriteria", + polymorphicDiscriminator: BackupCriteria.type.polymorphicDiscriminator, + modelProperties: { + ...BackupCriteria.type.modelProperties, + absoluteCriteria: { + serializedName: "absoluteCriteria", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + daysOfMonth: { + serializedName: "daysOfMonth", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Day" + } + } + } + }, + daysOfTheWeek: { + serializedName: "daysOfTheWeek", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + monthsOfYear: { + serializedName: "monthsOfYear", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + scheduleTimes: { + serializedName: "scheduleTimes", + type: { + name: "Sequence", + element: { + type: { + name: "DateTime" + } + } + } + }, + weeksOfTheMonth: { + serializedName: "weeksOfTheMonth", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const ItemPathBasedRestoreCriteria: coreClient.CompositeMapper = { + serializedName: "ItemPathBasedRestoreCriteria", + type: { + name: "Composite", + className: "ItemPathBasedRestoreCriteria", + uberParent: "ItemLevelRestoreCriteria", + polymorphicDiscriminator: + ItemLevelRestoreCriteria.type.polymorphicDiscriminator, + modelProperties: { + ...ItemLevelRestoreCriteria.type.modelProperties, + itemPath: { + serializedName: "itemPath", + required: true, + type: { + name: "String" + } + }, + isPathRelativeToBackupItem: { + serializedName: "isPathRelativeToBackupItem", + required: true, + type: { + name: "Boolean" + } + }, + subItemPathPrefix: { + serializedName: "subItemPathPrefix", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const RangeBasedItemLevelRestoreCriteria: coreClient.CompositeMapper = { + serializedName: "RangeBasedItemLevelRestoreCriteria", + type: { + name: "Composite", + className: "RangeBasedItemLevelRestoreCriteria", + uberParent: "ItemLevelRestoreCriteria", + polymorphicDiscriminator: + ItemLevelRestoreCriteria.type.polymorphicDiscriminator, + modelProperties: { + ...ItemLevelRestoreCriteria.type.modelProperties, + minMatchingValue: { + serializedName: "minMatchingValue", + type: { + name: "String" + } + }, + maxMatchingValue: { + serializedName: "maxMatchingValue", + type: { + name: "String" + } + } + } + } +}; + +export const KubernetesStorageClassRestoreCriteria: coreClient.CompositeMapper = { + serializedName: "KubernetesStorageClassRestoreCriteria", + type: { + name: "Composite", + className: "KubernetesStorageClassRestoreCriteria", + uberParent: "ItemLevelRestoreCriteria", + polymorphicDiscriminator: + ItemLevelRestoreCriteria.type.polymorphicDiscriminator, + modelProperties: { + ...ItemLevelRestoreCriteria.type.modelProperties, + selectedStorageClassName: { + serializedName: "selectedStorageClassName", + type: { + name: "String" + } + }, + provisioner: { + serializedName: "provisioner", + type: { + name: "String" + } + } + } + } +}; + +export const KubernetesPVRestoreCriteria: coreClient.CompositeMapper = { + serializedName: "KubernetesPVRestoreCriteria", + type: { + name: "Composite", + className: "KubernetesPVRestoreCriteria", + uberParent: "ItemLevelRestoreCriteria", + polymorphicDiscriminator: + ItemLevelRestoreCriteria.type.polymorphicDiscriminator, + modelProperties: { + ...ItemLevelRestoreCriteria.type.modelProperties, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + storageClassName: { + serializedName: "storageClassName", + type: { + name: "String" + } + } + } + } +}; + +export const KubernetesClusterRestoreCriteria: coreClient.CompositeMapper = { + serializedName: "KubernetesClusterRestoreCriteria", + type: { + name: "Composite", + className: "KubernetesClusterRestoreCriteria", + 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" } } + } + } + } + } +}; + +export const AzureBackupRestoreWithRehydrationRequest: coreClient.CompositeMapper = { + serializedName: "AzureBackupRestoreWithRehydrationRequest", + type: { + name: "Composite", + className: "AzureBackupRestoreWithRehydrationRequest", + uberParent: "AzureBackupRecoveryPointBasedRestoreRequest", + polymorphicDiscriminator: + AzureBackupRecoveryPointBasedRestoreRequest.type.polymorphicDiscriminator, + modelProperties: { + ...AzureBackupRecoveryPointBasedRestoreRequest.type.modelProperties, + rehydrationPriority: { + serializedName: "rehydrationPriority", + required: true, + type: { + name: "String" + } + }, + rehydrationRetentionDuration: { + serializedName: "rehydrationRetentionDuration", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const OperationResultGetHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationResultGetHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const BackupVaultOperationResultsGetHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupVaultOperationResultsGetHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const BackupInstancesCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupInstancesCreateOrUpdateHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + } + } + } +}; + +export const BackupInstancesDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupInstancesDeleteHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const BackupInstancesAdhocBackupHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupInstancesAdhocBackupHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const BackupInstancesValidateForBackupHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupInstancesValidateForBackupHeaders", + 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", + className: "BackupInstancesTriggerRehydrateHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const BackupInstancesTriggerRestoreHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupInstancesTriggerRestoreHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const BackupInstancesResumeBackupsHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupInstancesResumeBackupsHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const BackupInstancesResumeProtectionHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupInstancesResumeProtectionHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const BackupInstancesStopProtectionHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupInstancesStopProtectionHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const BackupInstancesSuspendBackupsHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupInstancesSuspendBackupsHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const BackupInstancesSyncBackupInstanceHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupInstancesSyncBackupInstanceHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const BackupInstancesValidateForRestoreHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupInstancesValidateForRestoreHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const ExportJobsTriggerHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExportJobsTriggerHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export let discriminators = { + OperationExtendedInfo: OperationExtendedInfo, + FeatureValidationRequestBase: FeatureValidationRequestBase, + FeatureValidationResponseBase: FeatureValidationResponseBase, + BaseBackupPolicy: BaseBackupPolicy, + DataStoreParameters: DataStoreParameters, + BackupDatasourceParameters: BackupDatasourceParameters, + AuthCredentials: AuthCredentials, + AzureBackupRecoveryPoint: AzureBackupRecoveryPoint, + AzureBackupRestoreRequest: AzureBackupRestoreRequest, + RestoreTargetInfoBase: RestoreTargetInfoBase, + DeleteOption: DeleteOption, + TriggerContext: TriggerContext, + BackupParameters: BackupParameters, + BasePolicyRule: BasePolicyRule, + CopyOption: CopyOption, + BackupCriteria: BackupCriteria, + ItemLevelRestoreCriteria: ItemLevelRestoreCriteria, + "OperationExtendedInfo.OperationJobExtendedInfo": OperationJobExtendedInfo, + "FeatureValidationRequestBase.FeatureValidationRequest": FeatureValidationRequest, + "FeatureValidationResponseBase.FeatureValidationResponse": FeatureValidationResponse, + "BaseBackupPolicy.BackupPolicy": BackupPolicy, + "DataStoreParameters.AzureOperationalStoreParameters": AzureOperationalStoreParameters, + "BackupDatasourceParameters.KubernetesClusterBackupDatasourceParameters": KubernetesClusterBackupDatasourceParameters, + "BackupDatasourceParameters.BlobBackupDatasourceParameters": BlobBackupDatasourceParameters, + "AuthCredentials.SecretStoreBasedAuthCredentials": SecretStoreBasedAuthCredentials, + "AzureBackupRecoveryPoint.AzureBackupDiscreteRecoveryPoint": AzureBackupDiscreteRecoveryPoint, + "AzureBackupRestoreRequest.AzureBackupRecoveryPointBasedRestoreRequest": AzureBackupRecoveryPointBasedRestoreRequest, + "AzureBackupRestoreRequest.AzureBackupRecoveryTimeBasedRestoreRequest": AzureBackupRecoveryTimeBasedRestoreRequest, + "RestoreTargetInfoBase.ItemLevelRestoreTargetInfo": ItemLevelRestoreTargetInfo, + "RestoreTargetInfoBase.RestoreFilesTargetInfo": RestoreFilesTargetInfo, + "RestoreTargetInfoBase.RestoreTargetInfo": RestoreTargetInfo, + "DeleteOption.AbsoluteDeleteOption": AbsoluteDeleteOption, + "TriggerContext.AdhocBasedTriggerContext": AdhocBasedTriggerContext, + "TriggerContext.ScheduleBasedTriggerContext": ScheduleBasedTriggerContext, + "BackupParameters.AzureBackupParams": AzureBackupParams, + "BasePolicyRule.AzureBackupRule": AzureBackupRule, + "BasePolicyRule.AzureRetentionRule": AzureRetentionRule, + "CopyOption.CopyOnExpiryOption": CopyOnExpiryOption, + "CopyOption.CustomCopyOption": CustomCopyOption, + "CopyOption.ImmediateCopyOption": ImmediateCopyOption, + "BackupCriteria.ScheduleBasedBackupCriteria": ScheduleBasedBackupCriteria, + "ItemLevelRestoreCriteria.ItemPathBasedRestoreCriteria": ItemPathBasedRestoreCriteria, + "ItemLevelRestoreCriteria.RangeBasedItemLevelRestoreCriteria": RangeBasedItemLevelRestoreCriteria, + "ItemLevelRestoreCriteria.KubernetesStorageClassRestoreCriteria": KubernetesStorageClassRestoreCriteria, + "ItemLevelRestoreCriteria.KubernetesPVRestoreCriteria": KubernetesPVRestoreCriteria, + "ItemLevelRestoreCriteria.KubernetesClusterRestoreCriteria": KubernetesClusterRestoreCriteria, + "AzureBackupRecoveryPointBasedRestoreRequest.AzureBackupRestoreWithRehydrationRequest": AzureBackupRestoreWithRehydrationRequest +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/models/parameters.ts b/sdk/dataprotection/arm-dataprotection/src/models/parameters.ts new file mode 100644 index 000000000000..4e430fc253cb --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/models/parameters.ts @@ -0,0 +1,334 @@ +/* + * 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 { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + BackupVaultResource as BackupVaultResourceMapper, + PatchResourceRequestInput as PatchResourceRequestInputMapper, + CheckNameAvailabilityRequest as CheckNameAvailabilityRequestMapper, + FeatureValidationRequestBase as FeatureValidationRequestBaseMapper, + BaseBackupPolicyResource as BaseBackupPolicyResourceMapper, + BackupInstanceResource as BackupInstanceResourceMapper, + TriggerBackupRequest as TriggerBackupRequestMapper, + ValidateForBackupRequest as ValidateForBackupRequestMapper, + AzureBackupRehydrationRequest as AzureBackupRehydrationRequestMapper, + AzureBackupRestoreRequest as AzureBackupRestoreRequestMapper, + SyncBackupInstanceRequest as SyncBackupInstanceRequestMapper, + ValidateRestoreRequestObject as ValidateRestoreRequestObjectMapper, + AzureBackupFindRestorableTimeRangesRequest as AzureBackupFindRestorableTimeRangesRequestMapper, + ResourceGuardResource as ResourceGuardResourceMapper, + ResourceGuardProxyBaseResource as ResourceGuardProxyBaseResourceMapper, + UnlockDeleteRequest as UnlockDeleteRequestMapper +} from "../models/mappers"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2022-11-01-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const vaultName: OperationURLParameter = { + parameterPath: "vaultName", + mapper: { + serializedName: "vaultName", + required: true, + type: { + name: "String" + } + } +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const parameters: OperationParameter = { + parameterPath: "parameters", + mapper: BackupVaultResourceMapper +}; + +export const parameters1: OperationParameter = { + parameterPath: "parameters", + mapper: PatchResourceRequestInputMapper +}; + +export const parameters2: OperationParameter = { + parameterPath: "parameters", + mapper: CheckNameAvailabilityRequestMapper +}; + +export const location: OperationURLParameter = { + parameterPath: "location", + mapper: { + serializedName: "location", + required: true, + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const operationId: OperationURLParameter = { + parameterPath: "operationId", + mapper: { + serializedName: "operationId", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters3: OperationParameter = { + parameterPath: "parameters", + mapper: FeatureValidationRequestBaseMapper +}; + +export const backupPolicyName: OperationURLParameter = { + parameterPath: "backupPolicyName", + mapper: { + serializedName: "backupPolicyName", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters4: OperationParameter = { + parameterPath: "parameters", + mapper: BaseBackupPolicyResourceMapper +}; + +export const backupInstanceName: OperationURLParameter = { + parameterPath: "backupInstanceName", + mapper: { + serializedName: "backupInstanceName", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters5: OperationParameter = { + parameterPath: "parameters", + mapper: BackupInstanceResourceMapper +}; + +export const parameters6: OperationParameter = { + parameterPath: "parameters", + mapper: TriggerBackupRequestMapper +}; + +export const parameters7: OperationParameter = { + parameterPath: "parameters", + mapper: ValidateForBackupRequestMapper +}; + +export const parameters8: OperationParameter = { + parameterPath: "parameters", + mapper: AzureBackupRehydrationRequestMapper +}; + +export const parameters9: OperationParameter = { + parameterPath: "parameters", + mapper: AzureBackupRestoreRequestMapper +}; + +export const parameters10: OperationParameter = { + parameterPath: "parameters", + mapper: SyncBackupInstanceRequestMapper +}; + +export const parameters11: OperationParameter = { + parameterPath: "parameters", + mapper: ValidateRestoreRequestObjectMapper +}; + +export const resourceId: OperationURLParameter = { + parameterPath: "resourceId", + mapper: { + serializedName: "resourceId", + required: true, + type: { + name: "String" + } + } +}; + +export const filter: OperationQueryParameter = { + parameterPath: ["options", "filter"], + mapper: { + serializedName: "$filter", + type: { + name: "String" + } + } +}; + +export const skipToken: OperationQueryParameter = { + parameterPath: ["options", "skipToken"], + mapper: { + serializedName: "$skipToken", + type: { + name: "String" + } + } +}; + +export const recoveryPointId: OperationURLParameter = { + parameterPath: "recoveryPointId", + mapper: { + serializedName: "recoveryPointId", + required: true, + type: { + name: "String" + } + } +}; + +export const jobId: OperationURLParameter = { + parameterPath: "jobId", + mapper: { + serializedName: "jobId", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters12: OperationParameter = { + parameterPath: "parameters", + mapper: AzureBackupFindRestorableTimeRangesRequestMapper +}; + +export const parameters13: OperationParameter = { + parameterPath: "parameters", + mapper: ResourceGuardResourceMapper +}; + +export const resourceGuardsName: OperationURLParameter = { + parameterPath: "resourceGuardsName", + mapper: { + serializedName: "resourceGuardsName", + required: true, + type: { + name: "String" + } + } +}; + +export const requestName: OperationURLParameter = { + parameterPath: "requestName", + mapper: { + serializedName: "requestName", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceGuardProxyName: OperationURLParameter = { + parameterPath: "resourceGuardProxyName", + mapper: { + serializedName: "resourceGuardProxyName", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters14: OperationParameter = { + parameterPath: "parameters", + mapper: ResourceGuardProxyBaseResourceMapper +}; + +export const parameters15: 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 new file mode 100644 index 000000000000..1a5e0b0c415e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/backupInstances.ts @@ -0,0 +1,1775 @@ +/* + * 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 { BackupInstances } 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 { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + BackupInstanceResource, + BackupInstancesListNextOptionalParams, + BackupInstancesListOptionalParams, + BackupInstancesListResponse, + BackupInstancesGetOptionalParams, + BackupInstancesGetResponse, + BackupInstancesCreateOrUpdateOptionalParams, + BackupInstancesCreateOrUpdateResponse, + BackupInstancesDeleteOptionalParams, + TriggerBackupRequest, + BackupInstancesAdhocBackupOptionalParams, + BackupInstancesAdhocBackupResponse, + ValidateForBackupRequest, + BackupInstancesValidateForBackupOptionalParams, + BackupInstancesValidateForBackupResponse, + BackupInstancesGetBackupInstanceOperationResultOptionalParams, + BackupInstancesGetBackupInstanceOperationResultResponse, + AzureBackupRehydrationRequest, + BackupInstancesTriggerRehydrateOptionalParams, + BackupInstancesTriggerRehydrateResponse, + AzureBackupRestoreRequestUnion, + BackupInstancesTriggerRestoreOptionalParams, + BackupInstancesTriggerRestoreResponse, + BackupInstancesResumeBackupsOptionalParams, + BackupInstancesResumeProtectionOptionalParams, + BackupInstancesStopProtectionOptionalParams, + BackupInstancesSuspendBackupsOptionalParams, + SyncBackupInstanceRequest, + BackupInstancesSyncBackupInstanceOptionalParams, + ValidateRestoreRequestObject, + BackupInstancesValidateForRestoreOptionalParams, + BackupInstancesValidateForRestoreResponse, + BackupInstancesListNextResponse +} from "../models"; + +/// +/** Class containing BackupInstances operations. */ +export class BackupInstancesImpl implements BackupInstances { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class BackupInstances class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Gets a backup instances belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + vaultName: string, + options?: BackupInstancesListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, vaultName, 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, + vaultName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + vaultName: string, + options?: BackupInstancesListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: BackupInstancesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, vaultName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + vaultName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + vaultName: string, + options?: BackupInstancesListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + vaultName, + options + )) { + yield* page; + } + } + + /** + * Gets a backup instances belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + vaultName: string, + options?: BackupInstancesListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, options }, + listOperationSpec + ); + } + + /** + * Gets a backup instance with name in a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, backupInstanceName, options }, + getOperationSpec + ); + } + + /** + * Create or update a backup instance in a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: BackupInstanceResource, + options?: BackupInstancesCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + BackupInstancesCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, vaultName, backupInstanceName, parameters, options }, + createOrUpdateOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Create or update a backup instance in a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: BackupInstanceResource, + options?: BackupInstancesCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + vaultName, + backupInstanceName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Delete a backup instance in a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, vaultName, backupInstanceName, options }, + deleteOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Delete a backup instance in a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + vaultName, + backupInstanceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Trigger adhoc backup + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginAdhocBackup( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: TriggerBackupRequest, + options?: BackupInstancesAdhocBackupOptionalParams + ): Promise< + PollerLike< + PollOperationState, + BackupInstancesAdhocBackupResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, vaultName, backupInstanceName, parameters, options }, + adhocBackupOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Trigger adhoc backup + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginAdhocBackupAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: TriggerBackupRequest, + options?: BackupInstancesAdhocBackupOptionalParams + ): Promise { + const poller = await this.beginAdhocBackup( + resourceGroupName, + vaultName, + backupInstanceName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Validate whether adhoc backup will be successful or not + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginValidateForBackup( + resourceGroupName: string, + vaultName: string, + parameters: ValidateForBackupRequest, + options?: BackupInstancesValidateForBackupOptionalParams + ): Promise< + PollerLike< + PollOperationState, + BackupInstancesValidateForBackupResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, vaultName, parameters, options }, + validateForBackupOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Validate whether adhoc backup will be successful or not + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginValidateForBackupAndWait( + resourceGroupName: string, + vaultName: string, + parameters: ValidateForBackupRequest, + options?: BackupInstancesValidateForBackupOptionalParams + ): Promise { + const poller = await this.beginValidateForBackup( + resourceGroupName, + vaultName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Get result of backup instance creation operation + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param operationId + * @param options The options parameters. + */ + getBackupInstanceOperationResult( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + operationId: string, + options?: BackupInstancesGetBackupInstanceOperationResultOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + vaultName, + backupInstanceName, + operationId, + options + }, + getBackupInstanceOperationResultOperationSpec + ); + } + + /** + * rehydrate recovery point for restore for a BackupInstance + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginTriggerRehydrate( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: AzureBackupRehydrationRequest, + options?: BackupInstancesTriggerRehydrateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + BackupInstancesTriggerRehydrateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, vaultName, backupInstanceName, parameters, options }, + triggerRehydrateOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * rehydrate recovery point for restore for a BackupInstance + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginTriggerRehydrateAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: AzureBackupRehydrationRequest, + options?: BackupInstancesTriggerRehydrateOptionalParams + ): Promise { + const poller = await this.beginTriggerRehydrate( + resourceGroupName, + vaultName, + backupInstanceName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Triggers restore for a BackupInstance + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginTriggerRestore( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: AzureBackupRestoreRequestUnion, + options?: BackupInstancesTriggerRestoreOptionalParams + ): Promise< + PollerLike< + PollOperationState, + BackupInstancesTriggerRestoreResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, vaultName, backupInstanceName, parameters, options }, + triggerRestoreOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Triggers restore for a BackupInstance + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginTriggerRestoreAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: AzureBackupRestoreRequestUnion, + options?: BackupInstancesTriggerRestoreOptionalParams + ): Promise { + const poller = await this.beginTriggerRestore( + resourceGroupName, + vaultName, + backupInstanceName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * This operation will resume backups for backup instance + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param options The options parameters. + */ + async beginResumeBackups( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesResumeBackupsOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, vaultName, backupInstanceName, options }, + resumeBackupsOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * This operation will resume backups for backup instance + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param options The options parameters. + */ + async beginResumeBackupsAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesResumeBackupsOptionalParams + ): Promise { + const poller = await this.beginResumeBackups( + resourceGroupName, + vaultName, + backupInstanceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * This operation will resume protection for a stopped backup instance + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param options The options parameters. + */ + async beginResumeProtection( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesResumeProtectionOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, vaultName, backupInstanceName, options }, + resumeProtectionOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * This operation will resume protection for a stopped backup instance + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param options The options parameters. + */ + async beginResumeProtectionAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesResumeProtectionOptionalParams + ): Promise { + const poller = await this.beginResumeProtection( + resourceGroupName, + vaultName, + backupInstanceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * This operation will stop protection of a backup instance and data will be held forever + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param options The options parameters. + */ + async beginStopProtection( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesStopProtectionOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, vaultName, backupInstanceName, options }, + stopProtectionOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * This operation will stop protection of a backup instance and data will be held forever + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param options The options parameters. + */ + async beginStopProtectionAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesStopProtectionOptionalParams + ): Promise { + const poller = await this.beginStopProtection( + resourceGroupName, + vaultName, + backupInstanceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * This operation will stop backup for a backup instance and retains the backup data as per the policy + * (except latest Recovery point, which will be retained forever) + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param options The options parameters. + */ + async beginSuspendBackups( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesSuspendBackupsOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, vaultName, backupInstanceName, options }, + suspendBackupsOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * This operation will stop backup for a backup instance and retains the backup data as per the policy + * (except latest Recovery point, which will be retained forever) + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param options The options parameters. + */ + async beginSuspendBackupsAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesSuspendBackupsOptionalParams + ): Promise { + const poller = await this.beginSuspendBackups( + resourceGroupName, + vaultName, + backupInstanceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Sync backup instance again in case of failure + * This action will retry last failed operation and will bring backup instance to valid state + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginSyncBackupInstance( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: SyncBackupInstanceRequest, + options?: BackupInstancesSyncBackupInstanceOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, vaultName, backupInstanceName, parameters, options }, + syncBackupInstanceOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Sync backup instance again in case of failure + * This action will retry last failed operation and will bring backup instance to valid state + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginSyncBackupInstanceAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: SyncBackupInstanceRequest, + options?: BackupInstancesSyncBackupInstanceOptionalParams + ): Promise { + const poller = await this.beginSyncBackupInstance( + resourceGroupName, + vaultName, + backupInstanceName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Validates if Restore can be triggered for a DataSource + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginValidateForRestore( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: ValidateRestoreRequestObject, + options?: BackupInstancesValidateForRestoreOptionalParams + ): Promise< + PollerLike< + PollOperationState, + BackupInstancesValidateForRestoreResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, vaultName, backupInstanceName, parameters, options }, + validateForRestoreOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Validates if Restore can be triggered for a DataSource + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginValidateForRestoreAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: ValidateRestoreRequestObject, + options?: BackupInstancesValidateForRestoreOptionalParams + ): Promise { + const poller = await this.beginValidateForRestore( + resourceGroupName, + vaultName, + backupInstanceName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + vaultName: string, + nextLink: string, + options?: BackupInstancesListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.BackupInstanceResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.BackupInstanceResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.BackupInstanceResource + }, + 201: { + bodyMapper: Mappers.BackupInstanceResource + }, + 202: { + bodyMapper: Mappers.BackupInstanceResource + }, + 204: { + bodyMapper: Mappers.BackupInstanceResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters5, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const adhocBackupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 201: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 202: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 204: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters6, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const validateForBackupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 201: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 202: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 204: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters7, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getBackupInstanceOperationResultOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/operationResults/{operationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.BackupInstanceResource + }, + 202: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.operationId, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const triggerRehydrateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate", + httpMethod: "POST", + responses: { + 200: { + headersMapper: Mappers.BackupInstancesTriggerRehydrateHeaders + }, + 201: { + headersMapper: Mappers.BackupInstancesTriggerRehydrateHeaders + }, + 202: { + headersMapper: Mappers.BackupInstancesTriggerRehydrateHeaders + }, + 204: { + headersMapper: Mappers.BackupInstancesTriggerRehydrateHeaders + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters8, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const triggerRestoreOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 201: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 202: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 204: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters9, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const resumeBackupsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const resumeProtectionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const stopProtectionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const suspendBackupsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const syncBackupInstanceOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters10, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const validateForRestoreOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 201: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 202: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 204: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters11, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.BackupInstanceResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/backupInstancesExtensionRouting.ts b/sdk/dataprotection/arm-dataprotection/src/operations/backupInstancesExtensionRouting.ts new file mode 100644 index 000000000000..5fdce17cf2f4 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/backupInstancesExtensionRouting.ts @@ -0,0 +1,161 @@ +/* + * 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 { BackupInstancesExtensionRouting } 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 { + BackupInstanceResource, + BackupInstancesExtensionRoutingListNextOptionalParams, + BackupInstancesExtensionRoutingListOptionalParams, + BackupInstancesExtensionRoutingListResponse, + BackupInstancesExtensionRoutingListNextResponse +} from "../models"; + +/// +/** Class containing BackupInstancesExtensionRouting operations. */ +export class BackupInstancesExtensionRoutingImpl + implements BackupInstancesExtensionRouting { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class BackupInstancesExtensionRouting class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Gets a list backup instances associated with a tracked resource + * @param resourceId ARM path of the resource to be protected using Microsoft.DataProtection + * @param options The options parameters. + */ + public list( + resourceId: string, + options?: BackupInstancesExtensionRoutingListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceId, 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(resourceId, options, settings); + } + }; + } + + private async *listPagingPage( + resourceId: string, + options?: BackupInstancesExtensionRoutingListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: BackupInstancesExtensionRoutingListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceId, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(resourceId, continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceId: string, + options?: BackupInstancesExtensionRoutingListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(resourceId, options)) { + yield* page; + } + } + + /** + * Gets a list backup instances associated with a tracked resource + * @param resourceId ARM path of the resource to be protected using Microsoft.DataProtection + * @param options The options parameters. + */ + private _list( + resourceId: string, + options?: BackupInstancesExtensionRoutingListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceId, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param resourceId ARM path of the resource to be protected using Microsoft.DataProtection + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceId: string, + nextLink: string, + options?: BackupInstancesExtensionRoutingListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceId, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/{resourceId}/providers/Microsoft.DataProtection/backupInstances", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.BackupInstanceResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.resourceId], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.BackupInstanceResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [Parameters.$host, Parameters.nextLink, Parameters.resourceId], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/backupPolicies.ts b/sdk/dataprotection/arm-dataprotection/src/operations/backupPolicies.ts new file mode 100644 index 000000000000..4baa034aaa43 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/backupPolicies.ts @@ -0,0 +1,328 @@ +/* + * 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 { BackupPolicies } 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 { + BaseBackupPolicyResource, + BackupPoliciesListNextOptionalParams, + BackupPoliciesListOptionalParams, + BackupPoliciesListResponse, + BackupPoliciesGetOptionalParams, + BackupPoliciesGetResponse, + BackupPoliciesCreateOrUpdateOptionalParams, + BackupPoliciesCreateOrUpdateResponse, + BackupPoliciesDeleteOptionalParams, + BackupPoliciesListNextResponse +} from "../models"; + +/// +/** Class containing BackupPolicies operations. */ +export class BackupPoliciesImpl implements BackupPolicies { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class BackupPolicies class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Returns list of backup policies belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + vaultName: string, + options?: BackupPoliciesListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, vaultName, 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, + vaultName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + vaultName: string, + options?: BackupPoliciesListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: BackupPoliciesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, vaultName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + vaultName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + vaultName: string, + options?: BackupPoliciesListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + vaultName, + options + )) { + yield* page; + } + } + + /** + * Returns list of backup policies belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + vaultName: string, + options?: BackupPoliciesListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, options }, + listOperationSpec + ); + } + + /** + * Gets a backup policy belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupPolicyName + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + backupPolicyName: string, + options?: BackupPoliciesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, backupPolicyName, options }, + getOperationSpec + ); + } + + /** + * Creates or Updates a backup policy belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupPolicyName Name of the policy + * @param parameters Request body for operation + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + vaultName: string, + backupPolicyName: string, + parameters: BaseBackupPolicyResource, + options?: BackupPoliciesCreateOrUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, backupPolicyName, parameters, options }, + createOrUpdateOperationSpec + ); + } + + /** + * Deletes a backup policy belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupPolicyName + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + vaultName: string, + backupPolicyName: string, + options?: BackupPoliciesDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, backupPolicyName, options }, + deleteOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + vaultName: string, + nextLink: string, + options?: BackupPoliciesListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.BaseBackupPolicyResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.BaseBackupPolicyResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupPolicyName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.BaseBackupPolicyResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters4, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupPolicyName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupPolicyName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.BaseBackupPolicyResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/backupVaultOperationResults.ts b/sdk/dataprotection/arm-dataprotection/src/operations/backupVaultOperationResults.ts new file mode 100644 index 000000000000..04ab09d4bd8f --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/backupVaultOperationResults.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 { BackupVaultOperationResults } 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 { + BackupVaultOperationResultsGetOptionalParams, + BackupVaultOperationResultsGetResponse +} from "../models"; + +/** Class containing BackupVaultOperationResults operations. */ +export class BackupVaultOperationResultsImpl + implements BackupVaultOperationResults { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class BackupVaultOperationResults class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param operationId + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + operationId: string, + options?: BackupVaultOperationResultsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, operationId, options }, + getOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationResults/{operationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.BackupVaultResource + }, + 202: { + headersMapper: Mappers.BackupVaultOperationResultsGetHeaders + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.operationId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/backupVaults.ts b/sdk/dataprotection/arm-dataprotection/src/operations/backupVaults.ts new file mode 100644 index 000000000000..f84bd9a94394 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/backupVaults.ts @@ -0,0 +1,689 @@ +/* + * 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 { BackupVaults } 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 { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + BackupVaultResource, + BackupVaultsGetInSubscriptionNextOptionalParams, + BackupVaultsGetInSubscriptionOptionalParams, + BackupVaultsGetInSubscriptionResponse, + BackupVaultsGetInResourceGroupNextOptionalParams, + BackupVaultsGetInResourceGroupOptionalParams, + BackupVaultsGetInResourceGroupResponse, + BackupVaultsGetOptionalParams, + BackupVaultsGetResponse, + BackupVaultsCreateOrUpdateOptionalParams, + BackupVaultsCreateOrUpdateResponse, + BackupVaultsDeleteOptionalParams, + PatchResourceRequestInput, + BackupVaultsUpdateOptionalParams, + BackupVaultsUpdateResponse, + CheckNameAvailabilityRequest, + BackupVaultsCheckNameAvailabilityOptionalParams, + BackupVaultsCheckNameAvailabilityResponse, + BackupVaultsGetInSubscriptionNextResponse, + BackupVaultsGetInResourceGroupNextResponse +} from "../models"; + +/// +/** Class containing BackupVaults operations. */ +export class BackupVaultsImpl implements BackupVaults { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class BackupVaults class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Returns resource collection belonging to a subscription. + * @param options The options parameters. + */ + public listInSubscription( + options?: BackupVaultsGetInSubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.getInSubscriptionPagingAll(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.getInSubscriptionPagingPage(options, settings); + } + }; + } + + private async *getInSubscriptionPagingPage( + options?: BackupVaultsGetInSubscriptionOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: BackupVaultsGetInSubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._getInSubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._getInSubscriptionNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *getInSubscriptionPagingAll( + options?: BackupVaultsGetInSubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.getInSubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * Returns resource collection belonging to a resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param options The options parameters. + */ + public listInResourceGroup( + resourceGroupName: string, + options?: BackupVaultsGetInResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.getInResourceGroupPagingAll(resourceGroupName, 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.getInResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); + } + }; + } + + private async *getInResourceGroupPagingPage( + resourceGroupName: string, + options?: BackupVaultsGetInResourceGroupOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: BackupVaultsGetInResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._getInResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._getInResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *getInResourceGroupPagingAll( + resourceGroupName: string, + options?: BackupVaultsGetInResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.getInResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Returns resource collection belonging to a subscription. + * @param options The options parameters. + */ + private _getInSubscription( + options?: BackupVaultsGetInSubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + getInSubscriptionOperationSpec + ); + } + + /** + * Returns resource collection belonging to a resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param options The options parameters. + */ + private _getInResourceGroup( + resourceGroupName: string, + options?: BackupVaultsGetInResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + getInResourceGroupOperationSpec + ); + } + + /** + * Returns a resource belonging to a resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + options?: BackupVaultsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, options }, + getOperationSpec + ); + } + + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + vaultName: string, + parameters: BackupVaultResource, + options?: BackupVaultsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + BackupVaultsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, vaultName, parameters, options }, + createOrUpdateOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + vaultName: string, + parameters: BackupVaultResource, + options?: BackupVaultsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + vaultName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Deletes a BackupVault resource from the resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + vaultName: string, + options?: BackupVaultsDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, options }, + deleteOperationSpec + ); + } + + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a + * resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginUpdate( + resourceGroupName: string, + vaultName: string, + parameters: PatchResourceRequestInput, + options?: BackupVaultsUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + BackupVaultsUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, vaultName, parameters, options }, + updateOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a + * resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param parameters Request body for operation + * @param options The options parameters. + */ + async beginUpdateAndWait( + resourceGroupName: string, + vaultName: string, + parameters: PatchResourceRequestInput, + options?: BackupVaultsUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + resourceGroupName, + vaultName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * API to check for resource name availability + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param location The location in which uniqueness will be verified. + * @param parameters Check name availability request + * @param options The options parameters. + */ + checkNameAvailability( + resourceGroupName: string, + location: string, + parameters: CheckNameAvailabilityRequest, + options?: BackupVaultsCheckNameAvailabilityOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, location, parameters, options }, + checkNameAvailabilityOperationSpec + ); + } + + /** + * GetInSubscriptionNext + * @param nextLink The nextLink from the previous successful call to the GetInSubscription method. + * @param options The options parameters. + */ + private _getInSubscriptionNext( + nextLink: string, + options?: BackupVaultsGetInSubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + getInSubscriptionNextOperationSpec + ); + } + + /** + * GetInResourceGroupNext + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param nextLink The nextLink from the previous successful call to the GetInResourceGroup method. + * @param options The options parameters. + */ + private _getInResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: BackupVaultsGetInResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + getInResourceGroupNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getInSubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.BackupVaultResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const getInResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.BackupVaultResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.BackupVaultResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.BackupVaultResource + }, + 201: { + bodyMapper: Mappers.BackupVaultResource + }, + 202: { + bodyMapper: Mappers.BackupVaultResource + }, + 204: { + bodyMapper: Mappers.BackupVaultResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName + ], + headerParameters: [Parameters.accept], + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.BackupVaultResource + }, + 201: { + bodyMapper: Mappers.BackupVaultResource + }, + 202: { + bodyMapper: Mappers.BackupVaultResource + }, + 204: { + bodyMapper: Mappers.BackupVaultResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.CheckNameAvailabilityResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.location + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getInSubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.BackupVaultResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const getInResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.BackupVaultResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/dataProtection.ts b/sdk/dataprotection/arm-dataprotection/src/operations/dataProtection.ts new file mode 100644 index 000000000000..e19a6a87fa58 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/dataProtection.ts @@ -0,0 +1,74 @@ +/* + * 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 { DataProtection } 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 { + FeatureValidationRequestBaseUnion, + DataProtectionCheckFeatureSupportOptionalParams, + DataProtectionCheckFeatureSupportResponse +} from "../models"; + +/** Class containing DataProtection operations. */ +export class DataProtectionImpl implements DataProtection { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class DataProtection class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Validates if a feature is supported + * @param location + * @param parameters Feature support request object + * @param options The options parameters. + */ + checkFeatureSupport( + location: string, + parameters: FeatureValidationRequestBaseUnion, + options?: DataProtectionCheckFeatureSupportOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { location, parameters, options }, + checkFeatureSupportOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const checkFeatureSupportOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.FeatureValidationResponseBase + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters3, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.location + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/dataProtectionOperations.ts b/sdk/dataprotection/arm-dataprotection/src/operations/dataProtectionOperations.ts new file mode 100644 index 000000000000..9c732b3c8070 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/dataProtectionOperations.ts @@ -0,0 +1,149 @@ +/* + * 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 { DataProtectionOperations } 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 { + ClientDiscoveryValueForSingleApi, + DataProtectionOperationsListNextOptionalParams, + DataProtectionOperationsListOptionalParams, + DataProtectionOperationsListResponse, + DataProtectionOperationsListNextResponse +} from "../models"; + +/// +/** Class containing DataProtectionOperations operations. */ +export class DataProtectionOperationsImpl implements DataProtectionOperations { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class DataProtectionOperations class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Returns the list of available operations. + * @param options The options parameters. + */ + public list( + options?: DataProtectionOperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(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(options, settings); + } + }; + } + + private async *listPagingPage( + options?: DataProtectionOperationsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: DataProtectionOperationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + options?: DataProtectionOperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Returns the list of available operations. + * @param options The options parameters. + */ + private _list( + options?: DataProtectionOperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: DataProtectionOperationsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.DataProtection/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ClientDiscoveryResponse + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ClientDiscoveryResponse + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/deletedBackupInstances.ts b/sdk/dataprotection/arm-dataprotection/src/operations/deletedBackupInstances.ts new file mode 100644 index 000000000000..44ea341ce7a7 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/deletedBackupInstances.ts @@ -0,0 +1,350 @@ +/* + * 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 { DeletedBackupInstances } 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 { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + DeletedBackupInstanceResource, + DeletedBackupInstancesListNextOptionalParams, + DeletedBackupInstancesListOptionalParams, + DeletedBackupInstancesListResponse, + DeletedBackupInstancesGetOptionalParams, + DeletedBackupInstancesGetResponse, + DeletedBackupInstancesUndeleteOptionalParams, + DeletedBackupInstancesListNextResponse +} from "../models"; + +/// +/** Class containing DeletedBackupInstances operations. */ +export class DeletedBackupInstancesImpl implements DeletedBackupInstances { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class DeletedBackupInstances class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Gets deleted backup instances belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + vaultName: string, + options?: DeletedBackupInstancesListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, vaultName, 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, + vaultName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + vaultName: string, + options?: DeletedBackupInstancesListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: DeletedBackupInstancesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, vaultName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + vaultName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + vaultName: string, + options?: DeletedBackupInstancesListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + vaultName, + options + )) { + yield* page; + } + } + + /** + * Gets deleted backup instances belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + vaultName: string, + options?: DeletedBackupInstancesListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, options }, + listOperationSpec + ); + } + + /** + * Gets a deleted backup instance with name in a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the deleted backup instance + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: DeletedBackupInstancesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, backupInstanceName, options }, + getOperationSpec + ); + } + + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the deleted backup instance + * @param options The options parameters. + */ + async beginUndelete( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: DeletedBackupInstancesUndeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, vaultName, backupInstanceName, options }, + undeleteOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the deleted backup instance + * @param options The options parameters. + */ + async beginUndeleteAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: DeletedBackupInstancesUndeleteOptionalParams + ): Promise { + const poller = await this.beginUndelete( + resourceGroupName, + vaultName, + backupInstanceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + vaultName: string, + nextLink: string, + options?: DeletedBackupInstancesListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeletedBackupInstanceResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeletedBackupInstanceResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const undeleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}/undelete", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeletedBackupInstanceResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/dppResourceGuardProxy.ts b/sdk/dataprotection/arm-dataprotection/src/operations/dppResourceGuardProxy.ts new file mode 100644 index 000000000000..66ebe57ac27f --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/dppResourceGuardProxy.ts @@ -0,0 +1,383 @@ +/* + * 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 { DppResourceGuardProxy } 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 { + ResourceGuardProxyBaseResource, + DppResourceGuardProxyListNextOptionalParams, + DppResourceGuardProxyListOptionalParams, + DppResourceGuardProxyListResponse, + DppResourceGuardProxyGetOptionalParams, + DppResourceGuardProxyGetResponse, + DppResourceGuardProxyPutOptionalParams, + DppResourceGuardProxyPutResponse, + DppResourceGuardProxyDeleteOptionalParams, + UnlockDeleteRequest, + DppResourceGuardProxyUnlockDeleteOptionalParams, + DppResourceGuardProxyUnlockDeleteResponse, + DppResourceGuardProxyListNextResponse +} from "../models"; + +/// +/** Class containing DppResourceGuardProxy operations. */ +export class DppResourceGuardProxyImpl implements DppResourceGuardProxy { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class DppResourceGuardProxy class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + vaultName: string, + options?: DppResourceGuardProxyListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, vaultName, 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, + vaultName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + vaultName: string, + options?: DppResourceGuardProxyListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: DppResourceGuardProxyListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, vaultName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + vaultName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + vaultName: string, + options?: DppResourceGuardProxyListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + vaultName, + options + )) { + yield* page; + } + } + + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + vaultName: string, + options?: DppResourceGuardProxyListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, options }, + listOperationSpec + ); + } + + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param resourceGuardProxyName + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + resourceGuardProxyName: string, + options?: DppResourceGuardProxyGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, resourceGuardProxyName, options }, + getOperationSpec + ); + } + + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param resourceGuardProxyName + * @param parameters Request body for operation + * @param options The options parameters. + */ + put( + resourceGroupName: string, + vaultName: string, + resourceGuardProxyName: string, + parameters: ResourceGuardProxyBaseResource, + options?: DppResourceGuardProxyPutOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + vaultName, + resourceGuardProxyName, + parameters, + options + }, + putOperationSpec + ); + } + + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param resourceGuardProxyName + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + vaultName: string, + resourceGuardProxyName: string, + options?: DppResourceGuardProxyDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, resourceGuardProxyName, options }, + deleteOperationSpec + ); + } + + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param resourceGuardProxyName + * @param parameters Request body for operation + * @param options The options parameters. + */ + unlockDelete( + resourceGroupName: string, + vaultName: string, + resourceGuardProxyName: string, + parameters: UnlockDeleteRequest, + options?: DppResourceGuardProxyUnlockDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + vaultName, + resourceGuardProxyName, + parameters, + options + }, + unlockDeleteOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + vaultName: string, + nextLink: string, + options?: DppResourceGuardProxyListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ResourceGuardProxyBaseResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ResourceGuardProxyBaseResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.resourceGuardProxyName + ], + headerParameters: [Parameters.accept], + serializer +}; +const putOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ResourceGuardProxyBaseResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters14, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.resourceGuardProxyName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.resourceGuardProxyName + ], + headerParameters: [Parameters.accept], + serializer +}; +const unlockDeleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.UnlockDeleteResponse + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters15, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.resourceGuardProxyName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ResourceGuardProxyBaseResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/exportJobs.ts b/sdk/dataprotection/arm-dataprotection/src/operations/exportJobs.ts new file mode 100644 index 000000000000..bc0e93fe33e3 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/exportJobs.ts @@ -0,0 +1,154 @@ +/* + * 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 { ExportJobs } 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 { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + ExportJobsTriggerOptionalParams, + ExportJobsTriggerResponse +} from "../models"; + +/** Class containing ExportJobs operations. */ +export class ExportJobsImpl implements ExportJobs { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class ExportJobs class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Triggers export of jobs and returns an OperationID to track. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + async beginTrigger( + resourceGroupName: string, + vaultName: string, + options?: ExportJobsTriggerOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ExportJobsTriggerResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, vaultName, options }, + triggerOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Triggers export of jobs and returns an OperationID to track. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + async beginTriggerAndWait( + resourceGroupName: string, + vaultName: string, + options?: ExportJobsTriggerOptionalParams + ): Promise { + const poller = await this.beginTrigger( + resourceGroupName, + vaultName, + options + ); + return poller.pollUntilDone(); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const triggerOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs", + httpMethod: "POST", + responses: { + 200: { + headersMapper: Mappers.ExportJobsTriggerHeaders + }, + 201: { + headersMapper: Mappers.ExportJobsTriggerHeaders + }, + 202: { + headersMapper: Mappers.ExportJobsTriggerHeaders + }, + 204: { + headersMapper: Mappers.ExportJobsTriggerHeaders + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/exportJobsOperationResult.ts b/sdk/dataprotection/arm-dataprotection/src/operations/exportJobsOperationResult.ts new file mode 100644 index 000000000000..55e307762dff --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/exportJobsOperationResult.ts @@ -0,0 +1,79 @@ +/* + * 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 { ExportJobsOperationResult } 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 { + ExportJobsOperationResultGetOptionalParams, + ExportJobsOperationResultGetResponse +} from "../models"; + +/** Class containing ExportJobsOperationResult operations. */ +export class ExportJobsOperationResultImpl + implements ExportJobsOperationResult { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class ExportJobsOperationResult class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, + * then it also contains URL of a Blob and a SAS key to access the same. The blob contains exported + * jobs in JSON serialized format. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param operationId OperationID which represents the export job. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + operationId: string, + options?: ExportJobsOperationResultGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, operationId, options }, + getOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/operations/{operationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ExportJobsResult + }, + 202: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.operationId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/index.ts b/sdk/dataprotection/arm-dataprotection/src/operations/index.ts new file mode 100644 index 000000000000..2f136d793287 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/index.ts @@ -0,0 +1,27 @@ +/* + * 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. + */ + +export * from "./backupVaults"; +export * from "./operationResult"; +export * from "./operationStatus"; +export * from "./operationStatusBackupVaultContext"; +export * from "./operationStatusResourceGroupContext"; +export * from "./backupVaultOperationResults"; +export * from "./dataProtection"; +export * from "./dataProtectionOperations"; +export * from "./backupPolicies"; +export * from "./backupInstances"; +export * from "./backupInstancesExtensionRouting"; +export * from "./recoveryPoints"; +export * from "./jobs"; +export * from "./restorableTimeRanges"; +export * from "./exportJobs"; +export * from "./exportJobsOperationResult"; +export * from "./deletedBackupInstances"; +export * from "./resourceGuards"; +export * from "./dppResourceGuardProxy"; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/jobs.ts b/sdk/dataprotection/arm-dataprotection/src/operations/jobs.ts new file mode 100644 index 000000000000..3c7ec5c3aa54 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/jobs.ts @@ -0,0 +1,239 @@ +/* + * 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 { Jobs } 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, + JobsListNextOptionalParams, + JobsListOptionalParams, + JobsListResponse, + JobsGetOptionalParams, + JobsGetResponse, + JobsListNextResponse +} from "../models"; + +/// +/** Class containing Jobs operations. */ +export class JobsImpl implements Jobs { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class Jobs class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Returns list of jobs belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + vaultName: string, + options?: JobsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, vaultName, 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, + vaultName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + vaultName: string, + options?: JobsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: JobsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, vaultName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + vaultName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + vaultName: string, + options?: JobsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + vaultName, + options + )) { + yield* page; + } + } + + /** + * Returns list of jobs belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + vaultName: string, + options?: JobsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, options }, + listOperationSpec + ); + } + + /** + * Gets a job with id in a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param jobId The Job ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + jobId: string, + options?: JobsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, jobId, options }, + getOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + vaultName: string, + nextLink: string, + options?: JobsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AzureBackupJobResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AzureBackupJobResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.jobId + ], + headerParameters: [Parameters.accept], + 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.vaultName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/operationResult.ts b/sdk/dataprotection/arm-dataprotection/src/operations/operationResult.ts new file mode 100644 index 000000000000..bf9307248707 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/operationResult.ts @@ -0,0 +1,75 @@ +/* + * 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 { OperationResult } 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 { + OperationResultGetOptionalParams, + OperationResultGetResponse +} from "../models"; + +/** Class containing OperationResult operations. */ +export class OperationResultImpl implements OperationResult { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class OperationResult class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Gets the operation result for a resource + * @param operationId + * @param location + * @param options The options parameters. + */ + get( + operationId: string, + location: string, + options?: OperationResultGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { operationId, location, options }, + getOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationResults/{operationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationJobExtendedInfo + }, + 202: { + headersMapper: Mappers.OperationResultGetHeaders + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.location, + Parameters.operationId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/operationStatus.ts b/sdk/dataprotection/arm-dataprotection/src/operations/operationStatus.ts new file mode 100644 index 000000000000..5036e96cfe9e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/operationStatus.ts @@ -0,0 +1,72 @@ +/* + * 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 { OperationStatus } 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 { + OperationStatusGetOptionalParams, + OperationStatusGetResponse +} from "../models"; + +/** Class containing OperationStatus operations. */ +export class OperationStatusImpl implements OperationStatus { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class OperationStatus class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Gets the operation status for a resource. + * @param location + * @param operationId + * @param options The options parameters. + */ + get( + location: string, + operationId: string, + options?: OperationStatusGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { location, operationId, options }, + getOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus/{operationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.location, + Parameters.operationId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/operationStatusBackupVaultContext.ts b/sdk/dataprotection/arm-dataprotection/src/operations/operationStatusBackupVaultContext.ts new file mode 100644 index 000000000000..f7a25e2d5a2a --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/operationStatusBackupVaultContext.ts @@ -0,0 +1,76 @@ +/* + * 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 { OperationStatusBackupVaultContext } 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 { + OperationStatusBackupVaultContextGetOptionalParams, + OperationStatusBackupVaultContextGetResponse +} from "../models"; + +/** Class containing OperationStatusBackupVaultContext operations. */ +export class OperationStatusBackupVaultContextImpl + implements OperationStatusBackupVaultContext { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class OperationStatusBackupVaultContext class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Gets the operation status for an operation over a BackupVault's context. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param operationId + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + operationId: string, + options?: OperationStatusBackupVaultContextGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, operationId, options }, + getOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationStatus/{operationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.operationId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/operationStatusResourceGroupContext.ts b/sdk/dataprotection/arm-dataprotection/src/operations/operationStatusResourceGroupContext.ts new file mode 100644 index 000000000000..603c1e7ed653 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/operationStatusResourceGroupContext.ts @@ -0,0 +1,73 @@ +/* + * 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 { OperationStatusResourceGroupContext } 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 { + OperationStatusResourceGroupContextGetOptionalParams, + OperationStatusResourceGroupContextGetResponse +} from "../models"; + +/** Class containing OperationStatusResourceGroupContext operations. */ +export class OperationStatusResourceGroupContextImpl + implements OperationStatusResourceGroupContext { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class OperationStatusResourceGroupContext class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Gets the operation status for an operation over a ResourceGroup's context. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param operationId + * @param options The options parameters. + */ + get( + resourceGroupName: string, + operationId: string, + options?: OperationStatusResourceGroupContextGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, operationId, options }, + getOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/operationStatus/{operationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.operationId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/recoveryPoints.ts b/sdk/dataprotection/arm-dataprotection/src/operations/recoveryPoints.ts new file mode 100644 index 000000000000..89127e4f450e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/recoveryPoints.ts @@ -0,0 +1,274 @@ +/* + * 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 { RecoveryPoints } 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, + RecoveryPointsListNextOptionalParams, + RecoveryPointsListOptionalParams, + RecoveryPointsListResponse, + RecoveryPointsGetOptionalParams, + RecoveryPointsGetResponse, + RecoveryPointsListNextResponse +} from "../models"; + +/// +/** Class containing RecoveryPoints operations. */ +export class RecoveryPointsImpl implements RecoveryPoints { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class RecoveryPoints class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Returns a list of Recovery Points for a DataSource in a vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: RecoveryPointsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + resourceGroupName, + vaultName, + backupInstanceName, + 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, + vaultName, + backupInstanceName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: RecoveryPointsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: RecoveryPointsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + resourceGroupName, + vaultName, + backupInstanceName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + vaultName, + backupInstanceName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: RecoveryPointsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + vaultName, + backupInstanceName, + options + )) { + yield* page; + } + } + + /** + * Returns a list of Recovery Points for a DataSource in a vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: RecoveryPointsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, backupInstanceName, options }, + listOperationSpec + ); + } + + /** + * Gets a Recovery Point using recoveryPointId for a Datasource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param recoveryPointId + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + recoveryPointId: string, + options?: RecoveryPointsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + vaultName, + backupInstanceName, + recoveryPointId, + options + }, + getOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + nextLink: string, + options?: RecoveryPointsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, backupInstanceName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AzureBackupRecoveryPointResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.skipToken + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AzureBackupRecoveryPointResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName, + Parameters.recoveryPointId + ], + headerParameters: [Parameters.accept], + 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.vaultName, + Parameters.nextLink, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/resourceGuards.ts b/sdk/dataprotection/arm-dataprotection/src/operations/resourceGuards.ts new file mode 100644 index 000000000000..92e712753bd3 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/resourceGuards.ts @@ -0,0 +1,1791 @@ +/* + * 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 { ResourceGuards } 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 { + ResourceGuardResource, + ResourceGuardsGetResourcesInSubscriptionNextOptionalParams, + ResourceGuardsGetResourcesInSubscriptionOptionalParams, + ResourceGuardsGetResourcesInSubscriptionResponse, + ResourceGuardsGetResourcesInResourceGroupNextOptionalParams, + ResourceGuardsGetResourcesInResourceGroupOptionalParams, + ResourceGuardsGetResourcesInResourceGroupResponse, + DppBaseResource, + ResourceGuardsGetDisableSoftDeleteRequestsObjectsNextOptionalParams, + ResourceGuardsGetDisableSoftDeleteRequestsObjectsOptionalParams, + ResourceGuardsGetDisableSoftDeleteRequestsObjectsResponse, + ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsNextOptionalParams, + ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsOptionalParams, + ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsResponse, + ResourceGuardsGetBackupSecurityPINRequestsObjectsNextOptionalParams, + ResourceGuardsGetBackupSecurityPINRequestsObjectsOptionalParams, + ResourceGuardsGetBackupSecurityPINRequestsObjectsResponse, + ResourceGuardsGetDeleteProtectedItemRequestsObjectsNextOptionalParams, + ResourceGuardsGetDeleteProtectedItemRequestsObjectsOptionalParams, + ResourceGuardsGetDeleteProtectedItemRequestsObjectsResponse, + ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsNextOptionalParams, + ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsOptionalParams, + ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsResponse, + ResourceGuardsGetUpdateProtectedItemRequestsObjectsNextOptionalParams, + ResourceGuardsGetUpdateProtectedItemRequestsObjectsOptionalParams, + ResourceGuardsGetUpdateProtectedItemRequestsObjectsResponse, + ResourceGuardsPutOptionalParams, + ResourceGuardsPutResponse, + ResourceGuardsGetOptionalParams, + ResourceGuardsGetResponse, + ResourceGuardsDeleteOptionalParams, + PatchResourceRequestInput, + ResourceGuardsPatchOptionalParams, + ResourceGuardsPatchResponse, + ResourceGuardsGetDefaultDisableSoftDeleteRequestsObjectOptionalParams, + ResourceGuardsGetDefaultDisableSoftDeleteRequestsObjectResponse, + ResourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectOptionalParams, + ResourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectResponse, + ResourceGuardsGetDefaultBackupSecurityPINRequestsObjectOptionalParams, + ResourceGuardsGetDefaultBackupSecurityPINRequestsObjectResponse, + ResourceGuardsGetDefaultDeleteProtectedItemRequestsObjectOptionalParams, + ResourceGuardsGetDefaultDeleteProtectedItemRequestsObjectResponse, + ResourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectOptionalParams, + ResourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectResponse, + ResourceGuardsGetDefaultUpdateProtectedItemRequestsObjectOptionalParams, + ResourceGuardsGetDefaultUpdateProtectedItemRequestsObjectResponse, + ResourceGuardsGetResourcesInSubscriptionNextResponse, + ResourceGuardsGetResourcesInResourceGroupNextResponse, + ResourceGuardsGetDisableSoftDeleteRequestsObjectsNextResponse, + ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsNextResponse, + ResourceGuardsGetBackupSecurityPINRequestsObjectsNextResponse, + ResourceGuardsGetDeleteProtectedItemRequestsObjectsNextResponse, + ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsNextResponse, + ResourceGuardsGetUpdateProtectedItemRequestsObjectsNextResponse +} from "../models"; + +/// +/** Class containing ResourceGuards operations. */ +export class ResourceGuardsImpl implements ResourceGuards { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class ResourceGuards class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * Returns ResourceGuards collection belonging to a subscription. + * @param options The options parameters. + */ + public listResourcesInSubscription( + options?: ResourceGuardsGetResourcesInSubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.getResourcesInSubscriptionPagingAll(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.getResourcesInSubscriptionPagingPage(options, settings); + } + }; + } + + private async *getResourcesInSubscriptionPagingPage( + options?: ResourceGuardsGetResourcesInSubscriptionOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: ResourceGuardsGetResourcesInSubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._getResourcesInSubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._getResourcesInSubscriptionNext( + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *getResourcesInSubscriptionPagingAll( + options?: ResourceGuardsGetResourcesInSubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.getResourcesInSubscriptionPagingPage( + options + )) { + yield* page; + } + } + + /** + * Returns ResourceGuards collection belonging to a ResourceGroup. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param options The options parameters. + */ + public listResourcesInResourceGroup( + resourceGroupName: string, + options?: ResourceGuardsGetResourcesInResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.getResourcesInResourceGroupPagingAll( + resourceGroupName, + 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.getResourcesInResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); + } + }; + } + + private async *getResourcesInResourceGroupPagingPage( + resourceGroupName: string, + options?: ResourceGuardsGetResourcesInResourceGroupOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: ResourceGuardsGetResourcesInResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._getResourcesInResourceGroup( + resourceGroupName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._getResourcesInResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *getResourcesInResourceGroupPagingAll( + resourceGroupName: string, + options?: ResourceGuardsGetResourcesInResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.getResourcesInResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + public listDisableSoftDeleteRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetDisableSoftDeleteRequestsObjectsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.getDisableSoftDeleteRequestsObjectsPagingAll( + resourceGroupName, + resourceGuardsName, + 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.getDisableSoftDeleteRequestsObjectsPagingPage( + resourceGroupName, + resourceGuardsName, + options, + settings + ); + } + }; + } + + private async *getDisableSoftDeleteRequestsObjectsPagingPage( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetDisableSoftDeleteRequestsObjectsOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: ResourceGuardsGetDisableSoftDeleteRequestsObjectsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._getDisableSoftDeleteRequestsObjects( + resourceGroupName, + resourceGuardsName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._getDisableSoftDeleteRequestsObjectsNext( + resourceGroupName, + resourceGuardsName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *getDisableSoftDeleteRequestsObjectsPagingAll( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetDisableSoftDeleteRequestsObjectsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.getDisableSoftDeleteRequestsObjectsPagingPage( + resourceGroupName, + resourceGuardsName, + options + )) { + yield* page; + } + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + public listDeleteResourceGuardProxyRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.getDeleteResourceGuardProxyRequestsObjectsPagingAll( + resourceGroupName, + resourceGuardsName, + 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.getDeleteResourceGuardProxyRequestsObjectsPagingPage( + resourceGroupName, + resourceGuardsName, + options, + settings + ); + } + }; + } + + private async *getDeleteResourceGuardProxyRequestsObjectsPagingPage( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._getDeleteResourceGuardProxyRequestsObjects( + resourceGroupName, + resourceGuardsName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._getDeleteResourceGuardProxyRequestsObjectsNext( + resourceGroupName, + resourceGuardsName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *getDeleteResourceGuardProxyRequestsObjectsPagingAll( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.getDeleteResourceGuardProxyRequestsObjectsPagingPage( + resourceGroupName, + resourceGuardsName, + options + )) { + yield* page; + } + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + public listBackupSecurityPINRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetBackupSecurityPINRequestsObjectsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.getBackupSecurityPINRequestsObjectsPagingAll( + resourceGroupName, + resourceGuardsName, + 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.getBackupSecurityPINRequestsObjectsPagingPage( + resourceGroupName, + resourceGuardsName, + options, + settings + ); + } + }; + } + + private async *getBackupSecurityPINRequestsObjectsPagingPage( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetBackupSecurityPINRequestsObjectsOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: ResourceGuardsGetBackupSecurityPINRequestsObjectsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._getBackupSecurityPINRequestsObjects( + resourceGroupName, + resourceGuardsName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._getBackupSecurityPINRequestsObjectsNext( + resourceGroupName, + resourceGuardsName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *getBackupSecurityPINRequestsObjectsPagingAll( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetBackupSecurityPINRequestsObjectsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.getBackupSecurityPINRequestsObjectsPagingPage( + resourceGroupName, + resourceGuardsName, + options + )) { + yield* page; + } + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + public listDeleteProtectedItemRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetDeleteProtectedItemRequestsObjectsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.getDeleteProtectedItemRequestsObjectsPagingAll( + resourceGroupName, + resourceGuardsName, + 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.getDeleteProtectedItemRequestsObjectsPagingPage( + resourceGroupName, + resourceGuardsName, + options, + settings + ); + } + }; + } + + private async *getDeleteProtectedItemRequestsObjectsPagingPage( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetDeleteProtectedItemRequestsObjectsOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: ResourceGuardsGetDeleteProtectedItemRequestsObjectsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._getDeleteProtectedItemRequestsObjects( + resourceGroupName, + resourceGuardsName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._getDeleteProtectedItemRequestsObjectsNext( + resourceGroupName, + resourceGuardsName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *getDeleteProtectedItemRequestsObjectsPagingAll( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetDeleteProtectedItemRequestsObjectsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.getDeleteProtectedItemRequestsObjectsPagingPage( + resourceGroupName, + resourceGuardsName, + options + )) { + yield* page; + } + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + public listUpdateProtectionPolicyRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.getUpdateProtectionPolicyRequestsObjectsPagingAll( + resourceGroupName, + resourceGuardsName, + 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.getUpdateProtectionPolicyRequestsObjectsPagingPage( + resourceGroupName, + resourceGuardsName, + options, + settings + ); + } + }; + } + + private async *getUpdateProtectionPolicyRequestsObjectsPagingPage( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._getUpdateProtectionPolicyRequestsObjects( + resourceGroupName, + resourceGuardsName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._getUpdateProtectionPolicyRequestsObjectsNext( + resourceGroupName, + resourceGuardsName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *getUpdateProtectionPolicyRequestsObjectsPagingAll( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.getUpdateProtectionPolicyRequestsObjectsPagingPage( + resourceGroupName, + resourceGuardsName, + options + )) { + yield* page; + } + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + public listUpdateProtectedItemRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetUpdateProtectedItemRequestsObjectsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.getUpdateProtectedItemRequestsObjectsPagingAll( + resourceGroupName, + resourceGuardsName, + 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.getUpdateProtectedItemRequestsObjectsPagingPage( + resourceGroupName, + resourceGuardsName, + options, + settings + ); + } + }; + } + + private async *getUpdateProtectedItemRequestsObjectsPagingPage( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetUpdateProtectedItemRequestsObjectsOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: ResourceGuardsGetUpdateProtectedItemRequestsObjectsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._getUpdateProtectedItemRequestsObjects( + resourceGroupName, + resourceGuardsName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._getUpdateProtectedItemRequestsObjectsNext( + resourceGroupName, + resourceGuardsName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *getUpdateProtectedItemRequestsObjectsPagingAll( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetUpdateProtectedItemRequestsObjectsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.getUpdateProtectedItemRequestsObjectsPagingPage( + resourceGroupName, + resourceGuardsName, + options + )) { + yield* page; + } + } + + /** + * Returns ResourceGuards collection belonging to a subscription. + * @param options The options parameters. + */ + private _getResourcesInSubscription( + options?: ResourceGuardsGetResourcesInSubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + getResourcesInSubscriptionOperationSpec + ); + } + + /** + * Returns ResourceGuards collection belonging to a ResourceGroup. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param options The options parameters. + */ + private _getResourcesInResourceGroup( + resourceGroupName: string, + options?: ResourceGuardsGetResourcesInResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + getResourcesInResourceGroupOperationSpec + ); + } + + /** + * Creates or updates a ResourceGuard resource belonging to a resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard + * @param parameters Request body for operation + * @param options The options parameters. + */ + put( + resourceGroupName: string, + resourceGuardsName: string, + parameters: ResourceGuardResource, + options?: ResourceGuardsPutOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, parameters, options }, + putOperationSpec + ); + } + + /** + * Returns a ResourceGuard belonging to a resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, options }, + getOperationSpec + ); + } + + /** + * Deletes a ResourceGuard resource from the resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, options }, + deleteOperationSpec + ); + } + + /** + * Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a + * resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard + * @param parameters Request body for operation + * @param options The options parameters. + */ + patch( + resourceGroupName: string, + resourceGuardsName: string, + parameters: PatchResourceRequestInput, + options?: ResourceGuardsPatchOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, parameters, options }, + patchOperationSpec + ); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + private _getDisableSoftDeleteRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetDisableSoftDeleteRequestsObjectsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, options }, + getDisableSoftDeleteRequestsObjectsOperationSpec + ); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + private _getDeleteResourceGuardProxyRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, options }, + getDeleteResourceGuardProxyRequestsObjectsOperationSpec + ); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + private _getBackupSecurityPINRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetBackupSecurityPINRequestsObjectsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, options }, + getBackupSecurityPINRequestsObjectsOperationSpec + ); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + private _getDeleteProtectedItemRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetDeleteProtectedItemRequestsObjectsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, options }, + getDeleteProtectedItemRequestsObjectsOperationSpec + ); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + private _getUpdateProtectionPolicyRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, options }, + getUpdateProtectionPolicyRequestsObjectsOperationSpec + ); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + private _getUpdateProtectedItemRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetUpdateProtectedItemRequestsObjectsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, options }, + getUpdateProtectedItemRequestsObjectsOperationSpec + ); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param requestName + * @param options The options parameters. + */ + getDefaultDisableSoftDeleteRequestsObject( + resourceGroupName: string, + resourceGuardsName: string, + requestName: string, + options?: ResourceGuardsGetDefaultDisableSoftDeleteRequestsObjectOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, requestName, options }, + getDefaultDisableSoftDeleteRequestsObjectOperationSpec + ); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param requestName + * @param options The options parameters. + */ + getDefaultDeleteResourceGuardProxyRequestsObject( + resourceGroupName: string, + resourceGuardsName: string, + requestName: string, + options?: ResourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectOptionalParams + ): Promise< + ResourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectResponse + > { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, requestName, options }, + getDefaultDeleteResourceGuardProxyRequestsObjectOperationSpec + ); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param requestName + * @param options The options parameters. + */ + getDefaultBackupSecurityPINRequestsObject( + resourceGroupName: string, + resourceGuardsName: string, + requestName: string, + options?: ResourceGuardsGetDefaultBackupSecurityPINRequestsObjectOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, requestName, options }, + getDefaultBackupSecurityPINRequestsObjectOperationSpec + ); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param requestName + * @param options The options parameters. + */ + getDefaultDeleteProtectedItemRequestsObject( + resourceGroupName: string, + resourceGuardsName: string, + requestName: string, + options?: ResourceGuardsGetDefaultDeleteProtectedItemRequestsObjectOptionalParams + ): Promise< + ResourceGuardsGetDefaultDeleteProtectedItemRequestsObjectResponse + > { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, requestName, options }, + getDefaultDeleteProtectedItemRequestsObjectOperationSpec + ); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param requestName + * @param options The options parameters. + */ + getDefaultUpdateProtectionPolicyRequestsObject( + resourceGroupName: string, + resourceGuardsName: string, + requestName: string, + options?: ResourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectOptionalParams + ): Promise< + ResourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectResponse + > { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, requestName, options }, + getDefaultUpdateProtectionPolicyRequestsObjectOperationSpec + ); + } + + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param requestName + * @param options The options parameters. + */ + getDefaultUpdateProtectedItemRequestsObject( + resourceGroupName: string, + resourceGuardsName: string, + requestName: string, + options?: ResourceGuardsGetDefaultUpdateProtectedItemRequestsObjectOptionalParams + ): Promise< + ResourceGuardsGetDefaultUpdateProtectedItemRequestsObjectResponse + > { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, requestName, options }, + getDefaultUpdateProtectedItemRequestsObjectOperationSpec + ); + } + + /** + * GetResourcesInSubscriptionNext + * @param nextLink The nextLink from the previous successful call to the GetResourcesInSubscription + * method. + * @param options The options parameters. + */ + private _getResourcesInSubscriptionNext( + nextLink: string, + options?: ResourceGuardsGetResourcesInSubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + getResourcesInSubscriptionNextOperationSpec + ); + } + + /** + * GetResourcesInResourceGroupNext + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param nextLink The nextLink from the previous successful call to the GetResourcesInResourceGroup + * method. + * @param options The options parameters. + */ + private _getResourcesInResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: ResourceGuardsGetResourcesInResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + getResourcesInResourceGroupNextOperationSpec + ); + } + + /** + * GetDisableSoftDeleteRequestsObjectsNext + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param nextLink The nextLink from the previous successful call to the + * GetDisableSoftDeleteRequestsObjects method. + * @param options The options parameters. + */ + private _getDisableSoftDeleteRequestsObjectsNext( + resourceGroupName: string, + resourceGuardsName: string, + nextLink: string, + options?: ResourceGuardsGetDisableSoftDeleteRequestsObjectsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, nextLink, options }, + getDisableSoftDeleteRequestsObjectsNextOperationSpec + ); + } + + /** + * GetDeleteResourceGuardProxyRequestsObjectsNext + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param nextLink The nextLink from the previous successful call to the + * GetDeleteResourceGuardProxyRequestsObjects method. + * @param options The options parameters. + */ + private _getDeleteResourceGuardProxyRequestsObjectsNext( + resourceGroupName: string, + resourceGuardsName: string, + nextLink: string, + options?: ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsNextOptionalParams + ): Promise< + ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsNextResponse + > { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, nextLink, options }, + getDeleteResourceGuardProxyRequestsObjectsNextOperationSpec + ); + } + + /** + * GetBackupSecurityPINRequestsObjectsNext + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param nextLink The nextLink from the previous successful call to the + * GetBackupSecurityPINRequestsObjects method. + * @param options The options parameters. + */ + private _getBackupSecurityPINRequestsObjectsNext( + resourceGroupName: string, + resourceGuardsName: string, + nextLink: string, + options?: ResourceGuardsGetBackupSecurityPINRequestsObjectsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, nextLink, options }, + getBackupSecurityPINRequestsObjectsNextOperationSpec + ); + } + + /** + * GetDeleteProtectedItemRequestsObjectsNext + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param nextLink The nextLink from the previous successful call to the + * GetDeleteProtectedItemRequestsObjects method. + * @param options The options parameters. + */ + private _getDeleteProtectedItemRequestsObjectsNext( + resourceGroupName: string, + resourceGuardsName: string, + nextLink: string, + options?: ResourceGuardsGetDeleteProtectedItemRequestsObjectsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, nextLink, options }, + getDeleteProtectedItemRequestsObjectsNextOperationSpec + ); + } + + /** + * GetUpdateProtectionPolicyRequestsObjectsNext + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param nextLink The nextLink from the previous successful call to the + * GetUpdateProtectionPolicyRequestsObjects method. + * @param options The options parameters. + */ + private _getUpdateProtectionPolicyRequestsObjectsNext( + resourceGroupName: string, + resourceGuardsName: string, + nextLink: string, + options?: ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsNextOptionalParams + ): Promise< + ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsNextResponse + > { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, nextLink, options }, + getUpdateProtectionPolicyRequestsObjectsNextOperationSpec + ); + } + + /** + * GetUpdateProtectedItemRequestsObjectsNext + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param nextLink The nextLink from the previous successful call to the + * GetUpdateProtectedItemRequestsObjects method. + * @param options The options parameters. + */ + private _getUpdateProtectedItemRequestsObjectsNext( + resourceGroupName: string, + resourceGuardsName: string, + nextLink: string, + options?: ResourceGuardsGetUpdateProtectedItemRequestsObjectsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceGuardsName, nextLink, options }, + getUpdateProtectedItemRequestsObjectsNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getResourcesInSubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ResourceGuardResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const getResourcesInResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ResourceGuardResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const putOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ResourceGuardResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters13, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceGuardsName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ResourceGuardResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceGuardsName + ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceGuardsName + ], + headerParameters: [Parameters.accept], + serializer +}; +const patchOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.ResourceGuardResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceGuardsName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getDisableSoftDeleteRequestsObjectsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceGuardsName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDeleteResourceGuardProxyRequestsObjectsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceGuardsName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getBackupSecurityPINRequestsObjectsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceGuardsName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDeleteProtectedItemRequestsObjectsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceGuardsName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getUpdateProtectionPolicyRequestsObjectsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceGuardsName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getUpdateProtectedItemRequestsObjectsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceGuardsName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDefaultDisableSoftDeleteRequestsObjectOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests/{requestName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceGuardsName, + Parameters.requestName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDefaultDeleteResourceGuardProxyRequestsObjectOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests/{requestName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceGuardsName, + Parameters.requestName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDefaultBackupSecurityPINRequestsObjectOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests/{requestName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceGuardsName, + Parameters.requestName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDefaultDeleteProtectedItemRequestsObjectOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests/{requestName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceGuardsName, + Parameters.requestName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDefaultUpdateProtectionPolicyRequestsObjectOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests/{requestName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceGuardsName, + Parameters.requestName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDefaultUpdateProtectedItemRequestsObjectOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests/{requestName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceGuardsName, + Parameters.requestName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getResourcesInSubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ResourceGuardResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const getResourcesInResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ResourceGuardResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDisableSoftDeleteRequestsObjectsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink, + Parameters.resourceGuardsName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDeleteResourceGuardProxyRequestsObjectsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink, + Parameters.resourceGuardsName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getBackupSecurityPINRequestsObjectsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink, + Parameters.resourceGuardsName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getDeleteProtectedItemRequestsObjectsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink, + Parameters.resourceGuardsName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getUpdateProtectionPolicyRequestsObjectsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink, + Parameters.resourceGuardsName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getUpdateProtectedItemRequestsObjectsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DppBaseResourceList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink, + Parameters.resourceGuardsName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operations/restorableTimeRanges.ts b/sdk/dataprotection/arm-dataprotection/src/operations/restorableTimeRanges.ts new file mode 100644 index 000000000000..2b54fd504a9f --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operations/restorableTimeRanges.ts @@ -0,0 +1,79 @@ +/* + * 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 { RestorableTimeRanges } 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 { + AzureBackupFindRestorableTimeRangesRequest, + RestorableTimeRangesFindOptionalParams, + RestorableTimeRangesFindResponse +} from "../models"; + +/** Class containing RestorableTimeRanges operations. */ +export class RestorableTimeRangesImpl implements RestorableTimeRanges { + private readonly client: DataProtectionClient; + + /** + * Initialize a new instance of the class RestorableTimeRanges class. + * @param client Reference to the service client + */ + constructor(client: DataProtectionClient) { + this.client = client; + } + + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + find( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: AzureBackupFindRestorableTimeRangesRequest, + options?: RestorableTimeRangesFindOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, vaultName, backupInstanceName, parameters, options }, + findOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const findOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/findRestorableTimeRanges", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.AzureBackupFindRestorableTimeRangesResponseResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters12, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.vaultName, + Parameters.backupInstanceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupInstances.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupInstances.ts new file mode 100644 index 000000000000..e223a1c75830 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupInstances.ts @@ -0,0 +1,456 @@ +/* + * 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 { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + BackupInstanceResource, + BackupInstancesListOptionalParams, + BackupInstancesGetOptionalParams, + BackupInstancesGetResponse, + BackupInstancesCreateOrUpdateOptionalParams, + BackupInstancesCreateOrUpdateResponse, + BackupInstancesDeleteOptionalParams, + TriggerBackupRequest, + BackupInstancesAdhocBackupOptionalParams, + BackupInstancesAdhocBackupResponse, + ValidateForBackupRequest, + BackupInstancesValidateForBackupOptionalParams, + BackupInstancesValidateForBackupResponse, + BackupInstancesGetBackupInstanceOperationResultOptionalParams, + BackupInstancesGetBackupInstanceOperationResultResponse, + AzureBackupRehydrationRequest, + BackupInstancesTriggerRehydrateOptionalParams, + BackupInstancesTriggerRehydrateResponse, + AzureBackupRestoreRequestUnion, + BackupInstancesTriggerRestoreOptionalParams, + BackupInstancesTriggerRestoreResponse, + BackupInstancesResumeBackupsOptionalParams, + BackupInstancesResumeProtectionOptionalParams, + BackupInstancesStopProtectionOptionalParams, + BackupInstancesSuspendBackupsOptionalParams, + SyncBackupInstanceRequest, + BackupInstancesSyncBackupInstanceOptionalParams, + ValidateRestoreRequestObject, + BackupInstancesValidateForRestoreOptionalParams, + BackupInstancesValidateForRestoreResponse +} from "../models"; + +/// +/** Interface representing a BackupInstances. */ +export interface BackupInstances { + /** + * Gets a backup instances belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + vaultName: string, + options?: BackupInstancesListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a backup instance with name in a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesGetOptionalParams + ): Promise; + /** + * Create or update a backup instance in a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: BackupInstanceResource, + options?: BackupInstancesCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + BackupInstancesCreateOrUpdateResponse + > + >; + /** + * Create or update a backup instance in a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: BackupInstanceResource, + options?: BackupInstancesCreateOrUpdateOptionalParams + ): Promise; + /** + * Delete a backup instance in a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesDeleteOptionalParams + ): Promise, void>>; + /** + * Delete a backup instance in a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesDeleteOptionalParams + ): Promise; + /** + * Trigger adhoc backup + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginAdhocBackup( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: TriggerBackupRequest, + options?: BackupInstancesAdhocBackupOptionalParams + ): Promise< + PollerLike< + PollOperationState, + BackupInstancesAdhocBackupResponse + > + >; + /** + * Trigger adhoc backup + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginAdhocBackupAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: TriggerBackupRequest, + options?: BackupInstancesAdhocBackupOptionalParams + ): Promise; + /** + * Validate whether adhoc backup will be successful or not + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginValidateForBackup( + resourceGroupName: string, + vaultName: string, + parameters: ValidateForBackupRequest, + options?: BackupInstancesValidateForBackupOptionalParams + ): Promise< + PollerLike< + PollOperationState, + BackupInstancesValidateForBackupResponse + > + >; + /** + * Validate whether adhoc backup will be successful or not + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginValidateForBackupAndWait( + resourceGroupName: string, + vaultName: string, + parameters: ValidateForBackupRequest, + options?: BackupInstancesValidateForBackupOptionalParams + ): Promise; + /** + * Get result of backup instance creation operation + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param operationId + * @param options The options parameters. + */ + getBackupInstanceOperationResult( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + operationId: string, + options?: BackupInstancesGetBackupInstanceOperationResultOptionalParams + ): Promise; + /** + * rehydrate recovery point for restore for a BackupInstance + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginTriggerRehydrate( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: AzureBackupRehydrationRequest, + options?: BackupInstancesTriggerRehydrateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + BackupInstancesTriggerRehydrateResponse + > + >; + /** + * rehydrate recovery point for restore for a BackupInstance + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginTriggerRehydrateAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: AzureBackupRehydrationRequest, + options?: BackupInstancesTriggerRehydrateOptionalParams + ): Promise; + /** + * Triggers restore for a BackupInstance + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginTriggerRestore( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: AzureBackupRestoreRequestUnion, + options?: BackupInstancesTriggerRestoreOptionalParams + ): Promise< + PollerLike< + PollOperationState, + BackupInstancesTriggerRestoreResponse + > + >; + /** + * Triggers restore for a BackupInstance + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginTriggerRestoreAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: AzureBackupRestoreRequestUnion, + options?: BackupInstancesTriggerRestoreOptionalParams + ): Promise; + /** + * This operation will resume backups for backup instance + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param options The options parameters. + */ + beginResumeBackups( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesResumeBackupsOptionalParams + ): Promise, void>>; + /** + * This operation will resume backups for backup instance + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param options The options parameters. + */ + beginResumeBackupsAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesResumeBackupsOptionalParams + ): Promise; + /** + * This operation will resume protection for a stopped backup instance + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param options The options parameters. + */ + beginResumeProtection( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesResumeProtectionOptionalParams + ): Promise, void>>; + /** + * This operation will resume protection for a stopped backup instance + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param options The options parameters. + */ + beginResumeProtectionAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesResumeProtectionOptionalParams + ): Promise; + /** + * This operation will stop protection of a backup instance and data will be held forever + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param options The options parameters. + */ + beginStopProtection( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesStopProtectionOptionalParams + ): Promise, void>>; + /** + * This operation will stop protection of a backup instance and data will be held forever + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param options The options parameters. + */ + beginStopProtectionAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesStopProtectionOptionalParams + ): Promise; + /** + * This operation will stop backup for a backup instance and retains the backup data as per the policy + * (except latest Recovery point, which will be retained forever) + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param options The options parameters. + */ + beginSuspendBackups( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesSuspendBackupsOptionalParams + ): Promise, void>>; + /** + * This operation will stop backup for a backup instance and retains the backup data as per the policy + * (except latest Recovery point, which will be retained forever) + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param options The options parameters. + */ + beginSuspendBackupsAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: BackupInstancesSuspendBackupsOptionalParams + ): Promise; + /** + * Sync backup instance again in case of failure + * This action will retry last failed operation and will bring backup instance to valid state + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginSyncBackupInstance( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: SyncBackupInstanceRequest, + options?: BackupInstancesSyncBackupInstanceOptionalParams + ): Promise, void>>; + /** + * Sync backup instance again in case of failure + * This action will retry last failed operation and will bring backup instance to valid state + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginSyncBackupInstanceAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: SyncBackupInstanceRequest, + options?: BackupInstancesSyncBackupInstanceOptionalParams + ): Promise; + /** + * Validates if Restore can be triggered for a DataSource + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginValidateForRestore( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: ValidateRestoreRequestObject, + options?: BackupInstancesValidateForRestoreOptionalParams + ): Promise< + PollerLike< + PollOperationState, + BackupInstancesValidateForRestoreResponse + > + >; + /** + * Validates if Restore can be triggered for a DataSource + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginValidateForRestoreAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: ValidateRestoreRequestObject, + options?: BackupInstancesValidateForRestoreOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupInstancesExtensionRouting.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupInstancesExtensionRouting.ts new file mode 100644 index 000000000000..96385661b169 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupInstancesExtensionRouting.ts @@ -0,0 +1,27 @@ +/* + * 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 { + BackupInstanceResource, + BackupInstancesExtensionRoutingListOptionalParams +} from "../models"; + +/// +/** Interface representing a BackupInstancesExtensionRouting. */ +export interface BackupInstancesExtensionRouting { + /** + * Gets a list backup instances associated with a tracked resource + * @param resourceId ARM path of the resource to be protected using Microsoft.DataProtection + * @param options The options parameters. + */ + list( + resourceId: string, + options?: BackupInstancesExtensionRoutingListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupPolicies.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupPolicies.ts new file mode 100644 index 000000000000..df788f26a273 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupPolicies.ts @@ -0,0 +1,75 @@ +/* + * 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 { + BaseBackupPolicyResource, + BackupPoliciesListOptionalParams, + BackupPoliciesGetOptionalParams, + BackupPoliciesGetResponse, + BackupPoliciesCreateOrUpdateOptionalParams, + BackupPoliciesCreateOrUpdateResponse, + BackupPoliciesDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a BackupPolicies. */ +export interface BackupPolicies { + /** + * Returns list of backup policies belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + vaultName: string, + options?: BackupPoliciesListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a backup policy belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupPolicyName + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + backupPolicyName: string, + options?: BackupPoliciesGetOptionalParams + ): Promise; + /** + * Creates or Updates a backup policy belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupPolicyName Name of the policy + * @param parameters Request body for operation + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + vaultName: string, + backupPolicyName: string, + parameters: BaseBackupPolicyResource, + options?: BackupPoliciesCreateOrUpdateOptionalParams + ): Promise; + /** + * Deletes a backup policy belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupPolicyName + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + vaultName: string, + backupPolicyName: string, + options?: BackupPoliciesDeleteOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupVaultOperationResults.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupVaultOperationResults.ts new file mode 100644 index 000000000000..1248987f2e50 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupVaultOperationResults.ts @@ -0,0 +1,28 @@ +/* + * 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 { + BackupVaultOperationResultsGetOptionalParams, + BackupVaultOperationResultsGetResponse +} from "../models"; + +/** Interface representing a BackupVaultOperationResults. */ +export interface BackupVaultOperationResults { + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param operationId + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + operationId: string, + options?: BackupVaultOperationResultsGetOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupVaults.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupVaults.ts new file mode 100644 index 000000000000..3204834e117e --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/backupVaults.ts @@ -0,0 +1,146 @@ +/* + * 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 { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + BackupVaultResource, + BackupVaultsGetInSubscriptionOptionalParams, + BackupVaultsGetInResourceGroupOptionalParams, + BackupVaultsGetOptionalParams, + BackupVaultsGetResponse, + BackupVaultsCreateOrUpdateOptionalParams, + BackupVaultsCreateOrUpdateResponse, + BackupVaultsDeleteOptionalParams, + PatchResourceRequestInput, + BackupVaultsUpdateOptionalParams, + BackupVaultsUpdateResponse, + CheckNameAvailabilityRequest, + BackupVaultsCheckNameAvailabilityOptionalParams, + BackupVaultsCheckNameAvailabilityResponse +} from "../models"; + +/// +/** Interface representing a BackupVaults. */ +export interface BackupVaults { + /** + * Returns resource collection belonging to a subscription. + * @param options The options parameters. + */ + listInSubscription( + options?: BackupVaultsGetInSubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns resource collection belonging to a resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param options The options parameters. + */ + listInResourceGroup( + resourceGroupName: string, + options?: BackupVaultsGetInResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns a resource belonging to a resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + options?: BackupVaultsGetOptionalParams + ): Promise; + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + vaultName: string, + parameters: BackupVaultResource, + options?: BackupVaultsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + BackupVaultsCreateOrUpdateResponse + > + >; + /** + * Creates or updates a BackupVault resource belonging to a resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + vaultName: string, + parameters: BackupVaultResource, + options?: BackupVaultsCreateOrUpdateOptionalParams + ): Promise; + /** + * Deletes a BackupVault resource from the resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + vaultName: string, + options?: BackupVaultsDeleteOptionalParams + ): Promise; + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a + * resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginUpdate( + resourceGroupName: string, + vaultName: string, + parameters: PatchResourceRequestInput, + options?: BackupVaultsUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + BackupVaultsUpdateResponse + > + >; + /** + * Updates a BackupVault resource belonging to a resource group. For example, updating tags for a + * resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param parameters Request body for operation + * @param options The options parameters. + */ + beginUpdateAndWait( + resourceGroupName: string, + vaultName: string, + parameters: PatchResourceRequestInput, + options?: BackupVaultsUpdateOptionalParams + ): Promise; + /** + * API to check for resource name availability + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param location The location in which uniqueness will be verified. + * @param parameters Check name availability request + * @param options The options parameters. + */ + checkNameAvailability( + resourceGroupName: string, + location: string, + parameters: CheckNameAvailabilityRequest, + options?: BackupVaultsCheckNameAvailabilityOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/dataProtection.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/dataProtection.ts new file mode 100644 index 000000000000..794e3b118b53 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/dataProtection.ts @@ -0,0 +1,28 @@ +/* + * 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 { + FeatureValidationRequestBaseUnion, + DataProtectionCheckFeatureSupportOptionalParams, + DataProtectionCheckFeatureSupportResponse +} from "../models"; + +/** Interface representing a DataProtection. */ +export interface DataProtection { + /** + * Validates if a feature is supported + * @param location + * @param parameters Feature support request object + * @param options The options parameters. + */ + checkFeatureSupport( + location: string, + parameters: FeatureValidationRequestBaseUnion, + options?: DataProtectionCheckFeatureSupportOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/dataProtectionOperations.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/dataProtectionOperations.ts new file mode 100644 index 000000000000..39ff1ed85898 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/dataProtectionOperations.ts @@ -0,0 +1,25 @@ +/* + * 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 { + ClientDiscoveryValueForSingleApi, + DataProtectionOperationsListOptionalParams +} from "../models"; + +/// +/** Interface representing a DataProtectionOperations. */ +export interface DataProtectionOperations { + /** + * Returns the list of available operations. + * @param options The options parameters. + */ + list( + options?: DataProtectionOperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/deletedBackupInstances.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/deletedBackupInstances.ts new file mode 100644 index 000000000000..b7d7875fe367 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/deletedBackupInstances.ts @@ -0,0 +1,70 @@ +/* + * 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 { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + DeletedBackupInstanceResource, + DeletedBackupInstancesListOptionalParams, + DeletedBackupInstancesGetOptionalParams, + DeletedBackupInstancesGetResponse, + DeletedBackupInstancesUndeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a DeletedBackupInstances. */ +export interface DeletedBackupInstances { + /** + * Gets deleted backup instances belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + vaultName: string, + options?: DeletedBackupInstancesListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a deleted backup instance with name in a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the deleted backup instance + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: DeletedBackupInstancesGetOptionalParams + ): Promise; + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the deleted backup instance + * @param options The options parameters. + */ + beginUndelete( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: DeletedBackupInstancesUndeleteOptionalParams + ): Promise, void>>; + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the deleted backup instance + * @param options The options parameters. + */ + beginUndeleteAndWait( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: DeletedBackupInstancesUndeleteOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/dppResourceGuardProxy.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/dppResourceGuardProxy.ts new file mode 100644 index 000000000000..fcefb7bef403 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/dppResourceGuardProxy.ts @@ -0,0 +1,88 @@ +/* + * 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 { + ResourceGuardProxyBaseResource, + DppResourceGuardProxyListOptionalParams, + DppResourceGuardProxyGetOptionalParams, + DppResourceGuardProxyGetResponse, + DppResourceGuardProxyPutOptionalParams, + DppResourceGuardProxyPutResponse, + DppResourceGuardProxyDeleteOptionalParams, + UnlockDeleteRequest, + DppResourceGuardProxyUnlockDeleteOptionalParams, + DppResourceGuardProxyUnlockDeleteResponse +} from "../models"; + +/// +/** Interface representing a DppResourceGuardProxy. */ +export interface DppResourceGuardProxy { + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + vaultName: string, + options?: DppResourceGuardProxyListOptionalParams + ): PagedAsyncIterableIterator; + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param resourceGuardProxyName + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + resourceGuardProxyName: string, + options?: DppResourceGuardProxyGetOptionalParams + ): Promise; + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param resourceGuardProxyName + * @param parameters Request body for operation + * @param options The options parameters. + */ + put( + resourceGroupName: string, + vaultName: string, + resourceGuardProxyName: string, + parameters: ResourceGuardProxyBaseResource, + options?: DppResourceGuardProxyPutOptionalParams + ): Promise; + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param resourceGuardProxyName + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + vaultName: string, + resourceGuardProxyName: string, + options?: DppResourceGuardProxyDeleteOptionalParams + ): Promise; + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param resourceGuardProxyName + * @param parameters Request body for operation + * @param options The options parameters. + */ + unlockDelete( + resourceGroupName: string, + vaultName: string, + resourceGuardProxyName: string, + parameters: UnlockDeleteRequest, + options?: DppResourceGuardProxyUnlockDeleteOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/exportJobs.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/exportJobs.ts new file mode 100644 index 000000000000..cda7426ddbd9 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/exportJobs.ts @@ -0,0 +1,44 @@ +/* + * 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 { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ExportJobsTriggerOptionalParams, + ExportJobsTriggerResponse +} from "../models"; + +/** Interface representing a ExportJobs. */ +export interface ExportJobs { + /** + * Triggers export of jobs and returns an OperationID to track. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + beginTrigger( + resourceGroupName: string, + vaultName: string, + options?: ExportJobsTriggerOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ExportJobsTriggerResponse + > + >; + /** + * Triggers export of jobs and returns an OperationID to track. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + beginTriggerAndWait( + resourceGroupName: string, + vaultName: string, + options?: ExportJobsTriggerOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/exportJobsOperationResult.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/exportJobsOperationResult.ts new file mode 100644 index 000000000000..6df2e3202a54 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/exportJobsOperationResult.ts @@ -0,0 +1,31 @@ +/* + * 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 { + ExportJobsOperationResultGetOptionalParams, + ExportJobsOperationResultGetResponse +} from "../models"; + +/** Interface representing a ExportJobsOperationResult. */ +export interface ExportJobsOperationResult { + /** + * Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, + * then it also contains URL of a Blob and a SAS key to access the same. The blob contains exported + * jobs in JSON serialized format. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param operationId OperationID which represents the export job. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + operationId: string, + options?: ExportJobsOperationResultGetOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/index.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..2f136d793287 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/index.ts @@ -0,0 +1,27 @@ +/* + * 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. + */ + +export * from "./backupVaults"; +export * from "./operationResult"; +export * from "./operationStatus"; +export * from "./operationStatusBackupVaultContext"; +export * from "./operationStatusResourceGroupContext"; +export * from "./backupVaultOperationResults"; +export * from "./dataProtection"; +export * from "./dataProtectionOperations"; +export * from "./backupPolicies"; +export * from "./backupInstances"; +export * from "./backupInstancesExtensionRouting"; +export * from "./recoveryPoints"; +export * from "./jobs"; +export * from "./restorableTimeRanges"; +export * from "./exportJobs"; +export * from "./exportJobsOperationResult"; +export * from "./deletedBackupInstances"; +export * from "./resourceGuards"; +export * from "./dppResourceGuardProxy"; diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/jobs.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/jobs.ts new file mode 100644 index 000000000000..b9a959b61880 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/jobs.ts @@ -0,0 +1,45 @@ +/* + * 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, + JobsListOptionalParams, + JobsGetOptionalParams, + JobsGetResponse +} from "../models"; + +/// +/** Interface representing a Jobs. */ +export interface Jobs { + /** + * Returns list of jobs belonging to a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + vaultName: string, + options?: JobsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a job with id in a backup vault + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param jobId The Job ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + jobId: string, + options?: JobsGetOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/operationResult.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/operationResult.ts new file mode 100644 index 000000000000..7f8ae87eb6d9 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/operationResult.ts @@ -0,0 +1,27 @@ +/* + * 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 { + OperationResultGetOptionalParams, + OperationResultGetResponse +} from "../models"; + +/** Interface representing a OperationResult. */ +export interface OperationResult { + /** + * Gets the operation result for a resource + * @param operationId + * @param location + * @param options The options parameters. + */ + get( + operationId: string, + location: string, + options?: OperationResultGetOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/operationStatus.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/operationStatus.ts new file mode 100644 index 000000000000..d84afc756527 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/operationStatus.ts @@ -0,0 +1,27 @@ +/* + * 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 { + OperationStatusGetOptionalParams, + OperationStatusGetResponse +} from "../models"; + +/** Interface representing a OperationStatus. */ +export interface OperationStatus { + /** + * Gets the operation status for a resource. + * @param location + * @param operationId + * @param options The options parameters. + */ + get( + location: string, + operationId: string, + options?: OperationStatusGetOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/operationStatusBackupVaultContext.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/operationStatusBackupVaultContext.ts new file mode 100644 index 000000000000..991537cf00b9 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/operationStatusBackupVaultContext.ts @@ -0,0 +1,29 @@ +/* + * 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 { + OperationStatusBackupVaultContextGetOptionalParams, + OperationStatusBackupVaultContextGetResponse +} from "../models"; + +/** Interface representing a OperationStatusBackupVaultContext. */ +export interface OperationStatusBackupVaultContext { + /** + * Gets the operation status for an operation over a BackupVault's context. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param operationId + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + operationId: string, + options?: OperationStatusBackupVaultContextGetOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/operationStatusResourceGroupContext.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/operationStatusResourceGroupContext.ts new file mode 100644 index 000000000000..bad6585bdcbb --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/operationStatusResourceGroupContext.ts @@ -0,0 +1,27 @@ +/* + * 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 { + OperationStatusResourceGroupContextGetOptionalParams, + OperationStatusResourceGroupContextGetResponse +} from "../models"; + +/** Interface representing a OperationStatusResourceGroupContext. */ +export interface OperationStatusResourceGroupContext { + /** + * Gets the operation status for an operation over a ResourceGroup's context. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param operationId + * @param options The options parameters. + */ + get( + resourceGroupName: string, + operationId: string, + options?: OperationStatusResourceGroupContextGetOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/recoveryPoints.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/recoveryPoints.ts new file mode 100644 index 000000000000..398f7ffaec89 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/recoveryPoints.ts @@ -0,0 +1,48 @@ +/* + * 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, + RecoveryPointsListOptionalParams, + RecoveryPointsGetOptionalParams, + RecoveryPointsGetResponse +} from "../models"; + +/// +/** Interface representing a RecoveryPoints. */ +export interface RecoveryPoints { + /** + * Returns a list of Recovery Points for a DataSource in a vault. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param options The options parameters. + */ + list( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + options?: RecoveryPointsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a Recovery Point using recoveryPointId for a Datasource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param recoveryPointId + * @param options The options parameters. + */ + get( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + recoveryPointId: string, + options?: RecoveryPointsGetOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/resourceGuards.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/resourceGuards.ts new file mode 100644 index 000000000000..69d101e2ec19 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/resourceGuards.ts @@ -0,0 +1,271 @@ +/* + * 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 { + ResourceGuardResource, + ResourceGuardsGetResourcesInSubscriptionOptionalParams, + ResourceGuardsGetResourcesInResourceGroupOptionalParams, + DppBaseResource, + ResourceGuardsGetDisableSoftDeleteRequestsObjectsOptionalParams, + ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsOptionalParams, + ResourceGuardsGetBackupSecurityPINRequestsObjectsOptionalParams, + ResourceGuardsGetDeleteProtectedItemRequestsObjectsOptionalParams, + ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsOptionalParams, + ResourceGuardsGetUpdateProtectedItemRequestsObjectsOptionalParams, + ResourceGuardsPutOptionalParams, + ResourceGuardsPutResponse, + ResourceGuardsGetOptionalParams, + ResourceGuardsGetResponse, + ResourceGuardsDeleteOptionalParams, + PatchResourceRequestInput, + ResourceGuardsPatchOptionalParams, + ResourceGuardsPatchResponse, + ResourceGuardsGetDefaultDisableSoftDeleteRequestsObjectOptionalParams, + ResourceGuardsGetDefaultDisableSoftDeleteRequestsObjectResponse, + ResourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectOptionalParams, + ResourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectResponse, + ResourceGuardsGetDefaultBackupSecurityPINRequestsObjectOptionalParams, + ResourceGuardsGetDefaultBackupSecurityPINRequestsObjectResponse, + ResourceGuardsGetDefaultDeleteProtectedItemRequestsObjectOptionalParams, + ResourceGuardsGetDefaultDeleteProtectedItemRequestsObjectResponse, + ResourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectOptionalParams, + ResourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectResponse, + ResourceGuardsGetDefaultUpdateProtectedItemRequestsObjectOptionalParams, + ResourceGuardsGetDefaultUpdateProtectedItemRequestsObjectResponse +} from "../models"; + +/// +/** Interface representing a ResourceGuards. */ +export interface ResourceGuards { + /** + * Returns ResourceGuards collection belonging to a subscription. + * @param options The options parameters. + */ + listResourcesInSubscription( + options?: ResourceGuardsGetResourcesInSubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns ResourceGuards collection belonging to a ResourceGroup. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param options The options parameters. + */ + listResourcesInResourceGroup( + resourceGroupName: string, + options?: ResourceGuardsGetResourcesInResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + listDisableSoftDeleteRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetDisableSoftDeleteRequestsObjectsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + listDeleteResourceGuardProxyRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetDeleteResourceGuardProxyRequestsObjectsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + listBackupSecurityPINRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetBackupSecurityPINRequestsObjectsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + listDeleteProtectedItemRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetDeleteProtectedItemRequestsObjectsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + listUpdateProtectionPolicyRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetUpdateProtectionPolicyRequestsObjectsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param options The options parameters. + */ + listUpdateProtectedItemRequestsObjects( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetUpdateProtectedItemRequestsObjectsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Creates or updates a ResourceGuard resource belonging to a resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard + * @param parameters Request body for operation + * @param options The options parameters. + */ + put( + resourceGroupName: string, + resourceGuardsName: string, + parameters: ResourceGuardResource, + options?: ResourceGuardsPutOptionalParams + ): Promise; + /** + * Returns a ResourceGuard belonging to a resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsGetOptionalParams + ): Promise; + /** + * Deletes a ResourceGuard resource from the resource group. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + resourceGuardsName: string, + options?: ResourceGuardsDeleteOptionalParams + ): Promise; + /** + * Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a + * resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName The name of ResourceGuard + * @param parameters Request body for operation + * @param options The options parameters. + */ + patch( + resourceGroupName: string, + resourceGuardsName: string, + parameters: PatchResourceRequestInput, + options?: ResourceGuardsPatchOptionalParams + ): Promise; + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param requestName + * @param options The options parameters. + */ + getDefaultDisableSoftDeleteRequestsObject( + resourceGroupName: string, + resourceGuardsName: string, + requestName: string, + options?: ResourceGuardsGetDefaultDisableSoftDeleteRequestsObjectOptionalParams + ): Promise; + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param requestName + * @param options The options parameters. + */ + getDefaultDeleteResourceGuardProxyRequestsObject( + resourceGroupName: string, + resourceGuardsName: string, + requestName: string, + options?: ResourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectOptionalParams + ): Promise< + ResourceGuardsGetDefaultDeleteResourceGuardProxyRequestsObjectResponse + >; + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param requestName + * @param options The options parameters. + */ + getDefaultBackupSecurityPINRequestsObject( + resourceGroupName: string, + resourceGuardsName: string, + requestName: string, + options?: ResourceGuardsGetDefaultBackupSecurityPINRequestsObjectOptionalParams + ): Promise; + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param requestName + * @param options The options parameters. + */ + getDefaultDeleteProtectedItemRequestsObject( + resourceGroupName: string, + resourceGuardsName: string, + requestName: string, + options?: ResourceGuardsGetDefaultDeleteProtectedItemRequestsObjectOptionalParams + ): Promise; + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param requestName + * @param options The options parameters. + */ + getDefaultUpdateProtectionPolicyRequestsObject( + resourceGroupName: string, + resourceGuardsName: string, + requestName: string, + options?: ResourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectOptionalParams + ): Promise< + ResourceGuardsGetDefaultUpdateProtectionPolicyRequestsObjectResponse + >; + /** + * Returns collection of operation request objects for a critical operation protected by the given + * ResourceGuard resource. + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param resourceGuardsName + * @param requestName + * @param options The options parameters. + */ + getDefaultUpdateProtectedItemRequestsObject( + resourceGroupName: string, + resourceGuardsName: string, + requestName: string, + options?: ResourceGuardsGetDefaultUpdateProtectedItemRequestsObjectOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/restorableTimeRanges.ts b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/restorableTimeRanges.ts new file mode 100644 index 000000000000..036fa42bef69 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/operationsInterfaces/restorableTimeRanges.ts @@ -0,0 +1,31 @@ +/* + * 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 { + AzureBackupFindRestorableTimeRangesRequest, + RestorableTimeRangesFindOptionalParams, + RestorableTimeRangesFindResponse +} from "../models"; + +/** Interface representing a RestorableTimeRanges. */ +export interface RestorableTimeRanges { + /** + * @param resourceGroupName The name of the resource group where the backup vault is present. + * @param vaultName The name of the backup vault. + * @param backupInstanceName The name of the backup instance + * @param parameters Request body for operation + * @param options The options parameters. + */ + find( + resourceGroupName: string, + vaultName: string, + backupInstanceName: string, + parameters: AzureBackupFindRestorableTimeRangesRequest, + options?: RestorableTimeRangesFindOptionalParams + ): Promise; +} diff --git a/sdk/dataprotection/arm-dataprotection/src/pagingHelper.ts b/sdk/dataprotection/arm-dataprotection/src/pagingHelper.ts new file mode 100644 index 000000000000..269a2b9814b5 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * 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. + */ + +export interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from + * that point later. + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. + */ +export function getContinuationToken(page: unknown): string | undefined { + if (typeof page !== "object" || page === null) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +} diff --git a/sdk/dataprotection/arm-dataprotection/test/dataprotection_operations_test.spec.ts b/sdk/dataprotection/arm-dataprotection/test/dataprotection_operations_test.spec.ts new file mode 100644 index 000000000000..bb183de6ac5d --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/test/dataprotection_operations_test.spec.ts @@ -0,0 +1,102 @@ +/* + * 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 { + env, + Recorder, + RecorderStartOptions, + delay, + isPlaybackMode, +} from "@azure-tools/test-recorder"; +import { createTestCredential } from "@azure-tools/test-credential"; +import { assert } from "chai"; +import { Context } from "mocha"; +import { DataProtectionClient } from "../src/dataProtectionClient"; + +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 +}; + +export const testPollingOptions = { + updateIntervalInMs: isPlaybackMode() ? 0 : undefined, +}; + +describe("DataProtection test", () => { + let recorder: Recorder; + let subscriptionId: string; + let client: DataProtectionClient; + let location: string; + let resourceGroup: string; + let vaultName: string; + + beforeEach(async function (this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + subscriptionId = env.SUBSCRIPTION_ID || ''; + // This is an example of how the environment variables are used + const credential = createTestCredential(); + client = new DataProtectionClient(credential, subscriptionId, recorder.configureClientOptions({})); + location = "eastus"; + resourceGroup = "myjstest"; + vaultName = "swaggerExample" + }); + + afterEach(async function () { + await recorder.stop(); + }); + + it("backupVaults create test", async function () { + const res = await client.backupVaults.beginCreateOrUpdateAndWait( + resourceGroup, + vaultName, + { + identity: { type: "None" }, + location, + properties: { + monitoringSettings: { + azureMonitorAlertSettings: { alertsForAllJobFailures: "Enabled" } + }, + storageSettings: [ + { type: "LocallyRedundant", datastoreType: "VaultStore" } + ] + }, + tags: { key1: "val1" } + }, + testPollingOptions); + assert.equal(res.name, vaultName); + }); + + it("backupVaults get test", async function () { + const res = await client.backupVaults.get(resourceGroup, vaultName); + assert.equal(res.name, vaultName); + }); + + it("backupVaults list test", async function () { + const resArray = new Array(); + for await (let item of client.backupVaults.listInResourceGroup(resourceGroup)) { + resArray.push(item); + } + assert.equal(resArray.length, 1); + }); + + it("backupVaults delete test", async function () { + const resArray = new Array(); + const res = await client.backupVaults.delete(resourceGroup, vaultName) + for await (let item of client.backupVaults.listInResourceGroup(resourceGroup)) { + resArray.push(item); + } + assert.equal(resArray.length, 0); + }); +}) diff --git a/sdk/dataprotection/arm-dataprotection/tsconfig.json b/sdk/dataprotection/arm-dataprotection/tsconfig.json new file mode 100644 index 000000000000..1f65f09046a1 --- /dev/null +++ b/sdk/dataprotection/arm-dataprotection/tsconfig.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6", + "dom" + ], + "declaration": true, + "outDir": "./dist-esm", + "importHelpers": true, + "paths": { + "@azure/arm-dataprotection": [ + "./src/index" + ] + } + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/dataprotection/ci.mgmt.yml b/sdk/dataprotection/ci.mgmt.yml new file mode 100644 index 000000000000..b34055c92ee2 --- /dev/null +++ b/sdk/dataprotection/ci.mgmt.yml @@ -0,0 +1,38 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/dataprotection/arm-dataprotection + - sdk/dataprotection/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/dataprotection/arm-dataprotection + - sdk/dataprotection/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: dataprotection + Artifacts: + - name: azure-arm-dataprotection + safeName: azurearmdataprotection + \ No newline at end of file